@dcl/sdk 7.0.0-3252840030.commit-001810b → 7.0.0-3277074139.commit-6059d49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ecs7/index.d.ts +1026 -43
- package/dist/ecs7/index.js +1419 -423
- package/dist/ecs7/index.min.js +1 -1
- package/dist/ecs7/index.min.js.map +1 -1
- package/dist/playground/snippets/cube-spawner.ts +1 -1
- package/package.json +4 -4
- package/types/ecs7/index.d.ts +1026 -43
package/dist/ecs7/index.d.ts
CHANGED
@@ -60,13 +60,699 @@ export declare const enum ColliderLayer {
|
|
60
60
|
CL_PHYSICS = 2
|
61
61
|
}
|
62
62
|
|
63
|
-
|
63
|
+
/**
|
64
|
+
* @public
|
65
|
+
* Color3 is a type and a namespace.
|
66
|
+
* - The namespace contains all types and functions to operates with Color3
|
67
|
+
* - The type Color3 is an alias to Color3.ReadonlyColor3
|
68
|
+
* ```
|
69
|
+
*
|
70
|
+
* // Namespace usage example
|
71
|
+
* Color3.add(blue, red) // sum component by component resulting pink
|
72
|
+
*
|
73
|
+
* // Type usage example
|
74
|
+
* const readonlyBlue: Color3 = Color3.Blue()
|
75
|
+
* readonlyBlue.r = 0.1 // this FAILS
|
76
|
+
*
|
77
|
+
* // For mutable usage, use `Color3.Mutable`
|
78
|
+
* const blue: Color3.Mutable = Color3.Blue()
|
79
|
+
* blue.r = 0.1 // this WORKS
|
80
|
+
* ```
|
81
|
+
*/
|
82
|
+
export declare type Color3 = Color3.ReadonlyColor3;
|
83
|
+
|
84
|
+
/**
|
85
|
+
* @public
|
86
|
+
* Color3 is a type and a namespace.
|
87
|
+
* ```
|
88
|
+
* // The namespace contains all types and functions to operates with Color3
|
89
|
+
* Color3.add(blue, red) // sum component by component resulting pink
|
90
|
+
* // The type Color3 is an alias to Color3.ReadonlyColor3
|
91
|
+
* const readonlyBlue: Color3 = Color3.Blue()
|
92
|
+
* readonlyBlue.r = 0.1 // this FAILS
|
93
|
+
*
|
94
|
+
* // For mutable usage, use `Color3.Mutable`
|
95
|
+
* const blue: Color3.Mutable = Color3.Blue()
|
96
|
+
* blue.r = 0.1 // this WORKS
|
97
|
+
* ```
|
98
|
+
*/
|
99
|
+
export declare namespace Color3 {
|
100
|
+
/**
|
101
|
+
* @public
|
102
|
+
* For external use, type with `Color3`, e.g. `const blackColor: Color3 = Color3.Black()`.
|
103
|
+
* For mutable typing, use `Color3.Mutable`, e.g. `const redColor: Color3.Mutable = Color3.Red()`.
|
104
|
+
*/
|
105
|
+
export type ReadonlyColor3 = {
|
106
|
+
readonly r: number;
|
107
|
+
readonly g: number;
|
108
|
+
readonly b: number;
|
109
|
+
};
|
110
|
+
/**
|
111
|
+
* @public
|
112
|
+
* For external usage, type with `Color3`, e.g. `const blackColor: Color3 = Color3.Black()`.
|
113
|
+
* For mutable typing, use `Color3.Mutable`, e.g. `const redColor: Color3.Mutable = Color3.Red()`.
|
114
|
+
*/
|
115
|
+
export type MutableColor3 = {
|
116
|
+
r: number;
|
117
|
+
g: number;
|
118
|
+
b: number;
|
119
|
+
};
|
120
|
+
/**
|
121
|
+
* @public
|
122
|
+
* Type with `Color3` for readonly usage, e.g. `const blackColor: Color3 = Color3.Black()`.
|
123
|
+
* For mutable, use `Color3.Mutable`, e.g. `const redColor: Color3.Mutable = Color3.Red()`.
|
124
|
+
*/
|
125
|
+
export type Mutable = MutableColor3;
|
126
|
+
/**
|
127
|
+
* Creates Color3 object from red, green, blue values, all between 0 and 1
|
128
|
+
* @param r - defines the red component (between 0 and 1, default is 0)
|
129
|
+
* @param g - defines the green component (between 0 and 1, default is 0)
|
130
|
+
* @param b - defines the blue component (between 0 and 1, default is 0)
|
131
|
+
*/
|
132
|
+
export function create(
|
133
|
+
/**
|
134
|
+
* Defines the red component (between 0 and 1, default is 0)
|
135
|
+
*/
|
136
|
+
r?: number,
|
137
|
+
/**
|
138
|
+
* Defines the green component (between 0 and 1, default is 0)
|
139
|
+
*/
|
140
|
+
g?: number,
|
141
|
+
/**
|
142
|
+
* Defines the blue component (between 0 and 1, default is 0)
|
143
|
+
*/
|
144
|
+
b?: number): {
|
145
|
+
r: number;
|
146
|
+
g: number;
|
147
|
+
b: number;
|
148
|
+
};
|
149
|
+
/**
|
150
|
+
* Creates a Vector3 from the string containing valid hexadecimal values
|
151
|
+
* @param hex - defines a string containing valid hexadecimal values
|
152
|
+
* @returns a new Vector3
|
153
|
+
*/
|
154
|
+
export function fromHexString(hex: string): MutableColor3;
|
155
|
+
/**
|
156
|
+
* Creates a new Vector3 from the starting index of the given array
|
157
|
+
* @param array - defines the source array
|
158
|
+
* @param offset - defines an offset in the source array
|
159
|
+
* @returns a new Vector3
|
160
|
+
*/
|
161
|
+
export function fromArray(array: ArrayLike<number>, offset?: number): MutableColor3;
|
162
|
+
/**
|
163
|
+
* Creates a Vector3 from integer values (less than 256)
|
164
|
+
* @param r - defines the red component to read from (value between 0 and 255)
|
165
|
+
* @param g - defines the green component to read from (value between 0 and 255)
|
166
|
+
* @param b - defines the blue component to read from (value between 0 and 255)
|
167
|
+
* @returns a new Vector3
|
168
|
+
*/
|
169
|
+
export function fromInts(r: number, g: number, b: number): MutableColor3;
|
170
|
+
/**
|
171
|
+
* Creates a Vector3 with values linearly interpolated of "amount" between the start Color3 and the end Color3
|
172
|
+
* @param start - defines the start Color3 value
|
173
|
+
* @param end - defines the end Color3 value
|
174
|
+
* @param amount - defines the gradient value between start and end
|
175
|
+
* @returns a new Vector3
|
176
|
+
*/
|
177
|
+
export function lerp(start: ReadonlyColor3, end: ReadonlyColor3, amount: number): MutableColor3;
|
178
|
+
/**
|
179
|
+
* Creates a Vector3 with values linearly interpolated of "amount" between the start Color3 and the end Color3
|
180
|
+
* @param left - defines the start value
|
181
|
+
* @param right - defines the end value
|
182
|
+
* @param amount - defines the gradient factor
|
183
|
+
* @param result - defines the Color3 object where to store the result
|
184
|
+
*/
|
185
|
+
export function lerpToRef(left: ReadonlyColor3, right: ReadonlyColor3, amount: number, result: MutableColor3): void;
|
186
|
+
/**
|
187
|
+
* Returns a Color3 value containing a red color
|
188
|
+
* @returns a new Vector3
|
189
|
+
*/
|
190
|
+
export function Red(): MutableColor3;
|
191
|
+
/**
|
192
|
+
* Returns a Color3 value containing a green color
|
193
|
+
* @returns a new Vector3
|
194
|
+
*/
|
195
|
+
export function Green(): MutableColor3;
|
196
|
+
/**
|
197
|
+
* Returns a Color3 value containing a blue color
|
198
|
+
* @returns a new Vector3
|
199
|
+
*/
|
200
|
+
export function Blue(): MutableColor3;
|
201
|
+
/**
|
202
|
+
* Returns a Color3 value containing a black color
|
203
|
+
* @returns a new Vector3
|
204
|
+
*/
|
205
|
+
export function Black(): MutableColor3;
|
206
|
+
/**
|
207
|
+
* Returns a Color3 value containing a white color
|
208
|
+
* @returns a new Vector3
|
209
|
+
*/
|
210
|
+
export function White(): MutableColor3;
|
211
|
+
/**
|
212
|
+
* Returns a Color3 value containing a purple color
|
213
|
+
* @returns a new Vector3
|
214
|
+
*/
|
215
|
+
export function Purple(): MutableColor3;
|
216
|
+
/**
|
217
|
+
* Returns a Color3 value containing a magenta color
|
218
|
+
* @returns a new Vector3
|
219
|
+
*/
|
220
|
+
export function Magenta(): MutableColor3;
|
221
|
+
/**
|
222
|
+
* Returns a Color3 value containing a yellow color
|
223
|
+
* @returns a new Vector3
|
224
|
+
*/
|
225
|
+
export function Yellow(): MutableColor3;
|
226
|
+
/**
|
227
|
+
* Returns a Color3 value containing a gray color
|
228
|
+
* @returns a new Vector3
|
229
|
+
*/
|
230
|
+
export function Gray(): MutableColor3;
|
231
|
+
/**
|
232
|
+
* Returns a Color3 value containing a teal color
|
233
|
+
* @returns a new Vector3
|
234
|
+
*/
|
235
|
+
export function Teal(): MutableColor3;
|
236
|
+
/**
|
237
|
+
* Returns a Color3 value containing a random color
|
238
|
+
* @returns a new Vector3
|
239
|
+
*/
|
240
|
+
export function Random(): MutableColor3;
|
241
|
+
/**
|
242
|
+
* Creates a string with the Color3 current values
|
243
|
+
* @returns the string representation of the Color3 object
|
244
|
+
*/
|
245
|
+
export function toString(value: ReadonlyColor3): string;
|
246
|
+
/**
|
247
|
+
* Compute the Color3 hash code
|
248
|
+
* @returns an unique number that can be used to hash Color3 objects
|
249
|
+
*/
|
250
|
+
export function getHashCode(value: ReadonlyColor3): number;
|
251
|
+
/**
|
252
|
+
* Stores in the given array from the given starting index the red, green, blue values as successive elements
|
253
|
+
* @param array - defines the array where to store the r,g,b components
|
254
|
+
* @param index - defines an optional index in the target array to define where to start storing values
|
255
|
+
*
|
256
|
+
*/
|
257
|
+
export function toArray(value: ReadonlyColor3, array: FloatArray, index?: number): void;
|
258
|
+
/**
|
259
|
+
* Returns a new Color4 object from the current Color3 and the given alpha
|
260
|
+
* @param alpha - defines the alpha component on the new Color4 object (default is 1)
|
261
|
+
* @returns a new Color4 object
|
262
|
+
*/
|
263
|
+
export function toColor4(value: ReadonlyColor3, alpha?: number): Color4.MutableColor4;
|
264
|
+
/**
|
265
|
+
* Returns a new array populated with 3 numeric elements : red, green and blue values
|
266
|
+
* @returns the new array
|
267
|
+
*/
|
268
|
+
export function asArray(value: ReadonlyColor3): number[];
|
269
|
+
/**
|
270
|
+
* Returns the luminance value
|
271
|
+
* @returns a float value
|
272
|
+
*/
|
273
|
+
export function toLuminance(value: ReadonlyColor3): number;
|
274
|
+
/**
|
275
|
+
* Multiply each Color3 rgb values by the given Color3 rgb values in Color3 object
|
276
|
+
* @param otherColor - defines the second operand
|
277
|
+
* @returns the create object
|
278
|
+
*/
|
279
|
+
export function multiply(value: ReadonlyColor3, otherColor: ReadonlyColor3): MutableColor3;
|
280
|
+
/**
|
281
|
+
* Multiply the rgb values of the Color3 and the given Color3 and stores the result in the object "result"
|
282
|
+
* @param otherColor - defines the second operand
|
283
|
+
* @param result - defines the Color3 object where to store the result
|
284
|
+
* @returns the current Color3
|
285
|
+
*/
|
286
|
+
export function multiplyToRef(value: ReadonlyColor3, otherColor: ReadonlyColor3, result: MutableColor3): void;
|
287
|
+
/**
|
288
|
+
* Determines equality between Color3 objects
|
289
|
+
* @param otherColor - defines the second operand
|
290
|
+
* @returns true if the rgb values are equal to the given ones
|
291
|
+
*/
|
292
|
+
export function equals(value: ReadonlyColor3, otherColor: ReadonlyColor3): boolean;
|
293
|
+
/**
|
294
|
+
* Determines equality between the current Color3 object and a set of r,b,g values
|
295
|
+
* @param r - defines the red component to check
|
296
|
+
* @param g - defines the green component to check
|
297
|
+
* @param b - defines the blue component to check
|
298
|
+
* @returns true if the rgb values are equal to the given ones
|
299
|
+
*/
|
300
|
+
export function equalsFloats(value: ReadonlyColor3, r: number, g: number, b: number): boolean;
|
301
|
+
/**
|
302
|
+
* Multiplies in place each rgb value by scale
|
303
|
+
* @param scale - defines the scaling factor
|
304
|
+
* @returns the updated Color3
|
305
|
+
*/
|
306
|
+
export function scale(value: ReadonlyColor3, scale: number): MutableColor3;
|
307
|
+
/**
|
308
|
+
* Multiplies the rgb values by scale and stores the result into "result"
|
309
|
+
* @param scale - defines the scaling factor
|
310
|
+
* @param result - defines the Color3 object where to store the result
|
311
|
+
* @returns the unmodified current Color3
|
312
|
+
*/
|
313
|
+
export function scaleToRef(value: ReadonlyColor3, scale: number, result: MutableColor3): void;
|
314
|
+
/**
|
315
|
+
* Scale the current Color3 values by a factor and add the result to a given Color3
|
316
|
+
* @param scale - defines the scale factor
|
317
|
+
* @param result - defines color to store the result into
|
318
|
+
* @returns the unmodified current Color3
|
319
|
+
*/
|
320
|
+
export function scaleAndAddToRef(value: ReadonlyColor3, scale: number, result: MutableColor3): void;
|
321
|
+
/**
|
322
|
+
* Clamps the rgb values by the min and max values and stores the result into "result"
|
323
|
+
* @param min - defines minimum clamping value (default is 0)
|
324
|
+
* @param max - defines maximum clamping value (default is 1)
|
325
|
+
* @param result - defines color to store the result into
|
326
|
+
* @returns the original Color3
|
327
|
+
*/
|
328
|
+
export function clampToRef(value: ReadonlyColor3, min: number | undefined, max: number | undefined, result: MutableColor3): void;
|
329
|
+
/**
|
330
|
+
* Clamps the rgb values by the min and max values and returns the result
|
331
|
+
* @param min - defines minimum clamping value (default is 0)
|
332
|
+
* @param max - defines maximum clamping value (default is 1)
|
333
|
+
* @returns result
|
334
|
+
*/
|
335
|
+
export function clamp(value: ReadonlyColor3, min?: number, max?: number): MutableColor3;
|
336
|
+
/**
|
337
|
+
* Creates Color3 set with the added values of the current Color3 and of the given one
|
338
|
+
* @param otherColor - defines the second operand
|
339
|
+
* @returns the create
|
340
|
+
*/
|
341
|
+
export function add(value: ReadonlyColor3, otherColor: ReadonlyColor3): MutableColor3;
|
342
|
+
/**
|
343
|
+
* Stores the result of the addition of the current Color3 and given one rgb values into "result"
|
344
|
+
* @param otherColor - defines the second operand
|
345
|
+
* @param result - defines Color3 object to store the result into
|
346
|
+
* @returns the unmodified current Color3
|
347
|
+
*/
|
348
|
+
export function addToRef(value: ReadonlyColor3, otherColor: ReadonlyColor3, result: MutableColor3): void;
|
349
|
+
/**
|
350
|
+
* Returns Color3 set with the subtracted values of the given one from the current Color3
|
351
|
+
* @param otherColor - defines the second operand
|
352
|
+
* @returns the create
|
353
|
+
*/
|
354
|
+
export function subtract(value: ReadonlyColor3, otherColor: ReadonlyColor3): MutableColor3;
|
355
|
+
/**
|
356
|
+
* Stores the result of the subtraction of given one from the current Color3 rgb values into "result"
|
357
|
+
* @param otherColor - defines the second operand
|
358
|
+
* @param result - defines Color3 object to store the result into
|
359
|
+
* @returns the unmodified current Color3
|
360
|
+
*/
|
361
|
+
export function subtractToRef(value: ReadonlyColor3, otherColor: ReadonlyColor3, result: MutableColor3): void;
|
362
|
+
/**
|
363
|
+
* Copy the current object
|
364
|
+
* @returns Color3 copied the current one
|
365
|
+
*/
|
366
|
+
export function clone(value: ReadonlyColor3): MutableColor3;
|
367
|
+
/**
|
368
|
+
* Copies the rgb values from the source in the current Color3
|
369
|
+
* @param source - defines the source Color3 object
|
370
|
+
* @returns the updated Color3 object
|
371
|
+
*/
|
372
|
+
export function copyFrom(source: ReadonlyColor3, dest: MutableColor3): void;
|
373
|
+
/**
|
374
|
+
* Updates the Color3 rgb values from the given floats
|
375
|
+
* @param dest -
|
376
|
+
* @param r - defines the red component to read from
|
377
|
+
* @param g - defines the green component to read from
|
378
|
+
* @param b - defines the blue component to read from
|
379
|
+
* @returns
|
380
|
+
*/
|
381
|
+
export function set(dest: MutableColor3, r: number, g: number, b: number): void;
|
382
|
+
/**
|
383
|
+
* Compute the Color3 hexadecimal code as a string
|
384
|
+
* @returns a string containing the hexadecimal representation of the Color3 object
|
385
|
+
*/
|
386
|
+
export function toHexString(value: ReadonlyColor3): string;
|
387
|
+
/**
|
388
|
+
* Computes Color3 converted from the current one to linear space
|
389
|
+
* @returns a new Vector3
|
390
|
+
*/
|
391
|
+
export function toLinearSpace(value: ReadonlyColor3): MutableColor3;
|
392
|
+
/**
|
393
|
+
* Converts the Color3 values to linear space and stores the result in "convertedColor"
|
394
|
+
* @param convertedColor - defines the Color3 object where to store the linear space version
|
395
|
+
* @returns the unmodified Color3
|
396
|
+
*/
|
397
|
+
export function toLinearSpaceToRef(value: ReadonlyColor3, convertedColor: MutableColor3): void;
|
398
|
+
/**
|
399
|
+
* Computes Color3 converted from the current one to gamma space
|
400
|
+
* @returns a new Vector3
|
401
|
+
*/
|
402
|
+
export function toGammaSpace(value: ReadonlyColor3): ReadonlyColor3;
|
403
|
+
/**
|
404
|
+
* Converts the Color3 values to gamma space and stores the result in "convertedColor"
|
405
|
+
* @param convertedColor - defines the Color3 object where to store the gamma space version
|
406
|
+
* @returns the unmodified Color3
|
407
|
+
*/
|
408
|
+
export function toGammaSpaceToRef(value: ReadonlyColor3, convertedColor: MutableColor3): void;
|
409
|
+
}
|
410
|
+
|
411
|
+
declare interface Color3_2 {
|
64
412
|
r: number;
|
65
413
|
g: number;
|
66
414
|
b: number;
|
67
415
|
}
|
68
416
|
|
69
|
-
|
417
|
+
/**
|
418
|
+
* @public
|
419
|
+
* Color4 is a type and a namespace.
|
420
|
+
* - The namespace contains all types and functions to operates with Color4
|
421
|
+
* - The type Color4 is an alias to Color4.ReadonlyColor4
|
422
|
+
* ```
|
423
|
+
*
|
424
|
+
* // Namespace usage example
|
425
|
+
* Color4.add(blue, red) // sum component by component resulting pink
|
426
|
+
*
|
427
|
+
* // Type usage example
|
428
|
+
* const readonlyBlue: Color4 = Color4.Blue()
|
429
|
+
* readonlyBlue.a = 0.1 // this FAILS
|
430
|
+
*
|
431
|
+
* // For mutable usage, use `Color4.Mutable`
|
432
|
+
* const blue: Color4.Mutable = Color4.Blue()
|
433
|
+
* blue.a = 0.1 // this WORKS
|
434
|
+
* ```
|
435
|
+
*/
|
436
|
+
export declare type Color4 = Color4.ReadonlyColor4;
|
437
|
+
|
438
|
+
/**
|
439
|
+
* @public
|
440
|
+
* Color4 is a type and a namespace.
|
441
|
+
* ```
|
442
|
+
* // The namespace contains all types and functions to operates with Color4
|
443
|
+
* Color4.add(blue, red) // sum component by component resulting pink
|
444
|
+
* // The type Color4 is an alias to Color4.ReadonlyColor4
|
445
|
+
* const readonlyBlue: Color4 = Color4.Blue()
|
446
|
+
* readonlyBlue.a = 0.1 // this FAILS
|
447
|
+
*
|
448
|
+
* // For mutable usage, use `Color4.Mutable`
|
449
|
+
* const blue: Color4.Mutable = Color4.Blue()
|
450
|
+
* blue.a = 0.1 // this WORKS
|
451
|
+
* ```
|
452
|
+
*/
|
453
|
+
export declare namespace Color4 {
|
454
|
+
/**
|
455
|
+
* @public
|
456
|
+
* For external use, type with `Color4`, e.g. `const blackColor: Color4 = Color4.Black()`.
|
457
|
+
* For mutable typing, use `Color4.Mutable`, e.g. `const redColor: Color4.Mutable = Color4.Red()`.
|
458
|
+
*/
|
459
|
+
export type ReadonlyColor4 = {
|
460
|
+
readonly r: number;
|
461
|
+
readonly g: number;
|
462
|
+
readonly b: number;
|
463
|
+
readonly a: number;
|
464
|
+
};
|
465
|
+
/**
|
466
|
+
* @public
|
467
|
+
* For external usage, type with `Color4`, e.g. `const blackColor: Color4 = Color4.Black()`.
|
468
|
+
* For mutable typing, use `Color4.Mutable`, e.g. `const redColor: Color4.Mutable = Color4.Red()`.
|
469
|
+
*/
|
470
|
+
export type MutableColor4 = {
|
471
|
+
r: number;
|
472
|
+
g: number;
|
473
|
+
b: number;
|
474
|
+
a: number;
|
475
|
+
};
|
476
|
+
/**
|
477
|
+
* @public
|
478
|
+
* Type with `Color4` for readonly usage, e.g. `const blackColor: Color4 = Color4.Black()`.
|
479
|
+
* For mutable, use `Color4.Mutable`, e.g. `const redColor: Color4.Mutable = Color4.Red()`.
|
480
|
+
*/
|
481
|
+
export type Mutable = MutableColor4;
|
482
|
+
/**
|
483
|
+
* Creates create mutable Color4 from red, green, blue values, all between 0 and 1
|
484
|
+
* @param r - defines the red component (between 0 and 1, default is 0)
|
485
|
+
* @param g - defines the green component (between 0 and 1, default is 0)
|
486
|
+
* @param b - defines the blue component (between 0 and 1, default is 0)
|
487
|
+
* @param a - defines the alpha component (between 0 and 1, default is 1)
|
488
|
+
*/
|
489
|
+
export function create(
|
490
|
+
/**
|
491
|
+
* Defines the red component (between 0 and 1, default is 0)
|
492
|
+
*/
|
493
|
+
r?: number,
|
494
|
+
/**
|
495
|
+
* Defines the green component (between 0 and 1, default is 0)
|
496
|
+
*/
|
497
|
+
g?: number,
|
498
|
+
/**
|
499
|
+
* Defines the blue component (between 0 and 1, default is 0)
|
500
|
+
*/
|
501
|
+
b?: number,
|
502
|
+
/**
|
503
|
+
* Defines the alpha component (between 0 and 1, default is 1)
|
504
|
+
*/
|
505
|
+
a?: number): MutableColor4;
|
506
|
+
/**
|
507
|
+
* Creates a Color4 from the string containing valid hexadecimal values
|
508
|
+
* @param hex - defines a string containing valid hexadecimal values
|
509
|
+
* @returns create mutable Color4
|
510
|
+
*/
|
511
|
+
export function fromHexString(hex: string): MutableColor4;
|
512
|
+
/**
|
513
|
+
* Creates create mutable Color4 set with the linearly interpolated values of "amount" between the left Color4 object and the right Color4 object
|
514
|
+
* @param left - defines the start value
|
515
|
+
* @param right - defines the end value
|
516
|
+
* @param amount - defines the gradient factor
|
517
|
+
* @returns create mutable Color4
|
518
|
+
*/
|
519
|
+
export function lerp(left: ReadonlyColor4, right: ReadonlyColor4, amount: number): MutableColor4;
|
520
|
+
/**
|
521
|
+
* Set the given "result" with the linearly interpolated values of "amount" between the left Color4 object and the right Color4 object
|
522
|
+
* @param left - defines the start value
|
523
|
+
* @param right - defines the end value
|
524
|
+
* @param amount - defines the gradient factor
|
525
|
+
* @param result - defines the Color4 object where to store data
|
526
|
+
*/
|
527
|
+
export function lerpToRef(left: ReadonlyColor4, right: ReadonlyColor4, amount: number, result: MutableColor4): void;
|
528
|
+
/**
|
529
|
+
* Returns a Color4 value containing a red color
|
530
|
+
* @returns a new Color4
|
531
|
+
*/
|
532
|
+
export function Red(): MutableColor4;
|
533
|
+
/**
|
534
|
+
* Returns a Color4 value containing a green color
|
535
|
+
* @returns create mutable Color4
|
536
|
+
*/
|
537
|
+
export function Green(): MutableColor4;
|
538
|
+
/**
|
539
|
+
* Returns a Color4 value containing a blue color
|
540
|
+
* @returns create mutable Color4
|
541
|
+
*/
|
542
|
+
export function Blue(): MutableColor4;
|
543
|
+
/**
|
544
|
+
* Returns a Color4 value containing a black color
|
545
|
+
* @returns create mutable Color4
|
546
|
+
*/
|
547
|
+
export function Black(): MutableColor4;
|
548
|
+
/**
|
549
|
+
* Returns a Color4 value containing a white color
|
550
|
+
* @returns create mutable Color4
|
551
|
+
*/
|
552
|
+
export function White(): MutableColor4;
|
553
|
+
/**
|
554
|
+
* Returns a Color4 value containing a purple color
|
555
|
+
* @returns create mutable Color4
|
556
|
+
*/
|
557
|
+
export function Purple(): MutableColor4;
|
558
|
+
/**
|
559
|
+
* Returns a Color4 value containing a magenta color
|
560
|
+
* @returns create mutable Color4
|
561
|
+
*/
|
562
|
+
export function Magenta(): MutableColor4;
|
563
|
+
/**
|
564
|
+
* Returns a Color4 value containing a yellow color
|
565
|
+
* @returns create mutable Color4
|
566
|
+
*/
|
567
|
+
export function Yellow(): MutableColor4;
|
568
|
+
/**
|
569
|
+
* Returns a Color4 value containing a gray color
|
570
|
+
* @returns create mutable Color4
|
571
|
+
*/
|
572
|
+
export function Gray(): MutableColor4;
|
573
|
+
/**
|
574
|
+
* Returns a Color4 value containing a teal color
|
575
|
+
* @returns create mutable Color4
|
576
|
+
*/
|
577
|
+
export function Teal(): MutableColor4;
|
578
|
+
/**
|
579
|
+
* Returns a Color4 value containing a transparent color
|
580
|
+
* @returns create mutable Color4
|
581
|
+
*/
|
582
|
+
export function Clear(): MutableColor4;
|
583
|
+
/**
|
584
|
+
* Creates a Color4 from a Color3 and an alpha value
|
585
|
+
* @param color3 - defines the source Color3 to read from
|
586
|
+
* @param alpha - defines the alpha component (1.0 by default)
|
587
|
+
* @returns create mutable Color4
|
588
|
+
*/
|
589
|
+
export function fromColor3(color3: Color3.ReadonlyColor3, alpha?: number): MutableColor4;
|
590
|
+
/**
|
591
|
+
* Creates a Color4 from the starting index element of the given array
|
592
|
+
* @param array - defines the source array to read from
|
593
|
+
* @param offset - defines the offset in the source array
|
594
|
+
* @returns create mutable Color4
|
595
|
+
*/
|
596
|
+
export function fromArray(array: ArrayLike<number>, offset?: number): ReadonlyColor4;
|
597
|
+
/**
|
598
|
+
* Creates a new Color3 from integer values (less than 256)
|
599
|
+
* @param r - defines the red component to read from (value between 0 and 255)
|
600
|
+
* @param g - defines the green component to read from (value between 0 and 255)
|
601
|
+
* @param b - defines the blue component to read from (value between 0 and 255)
|
602
|
+
* @param a - defines the alpha component to read from (value between 0 and 255)
|
603
|
+
* @returns a new Color4
|
604
|
+
*/
|
605
|
+
export function fromInts(r: number, g: number, b: number, a: number): MutableColor4;
|
606
|
+
/**
|
607
|
+
* Check the content of a given array and convert it to an array containing RGBA data
|
608
|
+
* If the original array was already containing count * 4 values then it is returned directly
|
609
|
+
* @param colors - defines the array to check
|
610
|
+
* @param count - defines the number of RGBA data to expect
|
611
|
+
* @returns an array containing count * 4 values (RGBA)
|
612
|
+
*/
|
613
|
+
export function checkColors4(colors: number[], count: number): number[];
|
614
|
+
/**
|
615
|
+
* Adds the given Color4 values to the ref Color4 object
|
616
|
+
* @param a - defines the first operand
|
617
|
+
* @param b - defines the second operand
|
618
|
+
* @param ref - defines the result rference
|
619
|
+
* @returns
|
620
|
+
*/
|
621
|
+
export function addToRef(a: ReadonlyColor4, b: ReadonlyColor4, ref: MutableColor4): void;
|
622
|
+
/**
|
623
|
+
* Stores from the starting index in the given array the Color4 successive values
|
624
|
+
* @param array - defines the array where to store the r,g,b components
|
625
|
+
* @param index - defines an optional index in the target array to define where to start storing values
|
626
|
+
* @returns the current Color4 object
|
627
|
+
*/
|
628
|
+
export function toArray(value: ReadonlyColor4, array: number[], index?: number): void;
|
629
|
+
/**
|
630
|
+
* Creates a Color4 set with the added values of the current Color4 and of the given one
|
631
|
+
* @param right - defines the second operand
|
632
|
+
* @returns create mutable Color4
|
633
|
+
*/
|
634
|
+
export function add(value: ReadonlyColor4, right: ReadonlyColor4): MutableColor4;
|
635
|
+
/**
|
636
|
+
* Creates a Color4 set with the subtracted values of the given one from the current Color4
|
637
|
+
* @param right - defines the second operand
|
638
|
+
* @returns create mutable Color4
|
639
|
+
*/
|
640
|
+
export function subtract(value: ReadonlyColor4, right: ReadonlyColor4): ReadonlyColor4;
|
641
|
+
/**
|
642
|
+
* Subtracts the given ones from the current Color4 values and stores the results in "result"
|
643
|
+
* @param right - defines the second operand
|
644
|
+
* @param result - defines the Color4 object where to store the result
|
645
|
+
* @returns the current Color4 object
|
646
|
+
*/
|
647
|
+
export function subtractToRef(a: ReadonlyColor4, b: ReadonlyColor4, result: MutableColor4): void;
|
648
|
+
/**
|
649
|
+
* Creates a Color4 with the current Color4 values multiplied by scale
|
650
|
+
* @param scale - defines the scaling factor to apply
|
651
|
+
* @returns create mutable Color4
|
652
|
+
*/
|
653
|
+
export function scale(value: ReadonlyColor4, scale: number): ReadonlyColor4;
|
654
|
+
/**
|
655
|
+
* Multiplies the current Color4 values by scale and stores the result in "result"
|
656
|
+
* @param scale - defines the scaling factor to apply
|
657
|
+
* @param result - defines the Color4 object where to store the result
|
658
|
+
*/
|
659
|
+
export function scaleToRef(value: ReadonlyColor4, scale: number, result: MutableColor4): void;
|
660
|
+
/**
|
661
|
+
* Scale the current Color4 values by a factor and add the result to a given Color4
|
662
|
+
* @param scale - defines the scale factor
|
663
|
+
* @param result - defines the Color4 object where to store the result
|
664
|
+
*/
|
665
|
+
export function scaleAndAddToRef(value: ReadonlyColor4, scale: number, result: MutableColor4): void;
|
666
|
+
/**
|
667
|
+
* Clamps the rgb values by the min and max values and stores the result into "result"
|
668
|
+
* @param min - defines minimum clamping value (default is 0)
|
669
|
+
* @param max - defines maximum clamping value (default is 1)
|
670
|
+
* @param result - defines color to store the result into.
|
671
|
+
*/
|
672
|
+
export function clampToRef(value: ReadonlyColor4, min: number | undefined, max: number | undefined, result: MutableColor4): void;
|
673
|
+
/**
|
674
|
+
* Multipy an Color4 value by another and return create mutable Color4
|
675
|
+
* @param color - defines the Color4 value to multiply by
|
676
|
+
* @returns create mutable Color4
|
677
|
+
*/
|
678
|
+
export function multiply(value: ReadonlyColor4, color: ReadonlyColor4): ReadonlyColor4;
|
679
|
+
/**
|
680
|
+
* Multipy a Color4 value by another and push the result in a reference value
|
681
|
+
* @param color - defines the Color4 value to multiply by
|
682
|
+
* @param result - defines the Color4 to fill the result in
|
683
|
+
* @returns the result Color4
|
684
|
+
*/
|
685
|
+
export function multiplyToRef(value: ReadonlyColor4, color: ReadonlyColor4, result: MutableColor4): void;
|
686
|
+
/**
|
687
|
+
* Creates a string with the Color4 current values
|
688
|
+
* @returns the string representation of the Color4 object
|
689
|
+
*/
|
690
|
+
export function toString(value: ReadonlyColor4): string;
|
691
|
+
/**
|
692
|
+
* Compute the Color4 hash code
|
693
|
+
* @returns an unique number that can be used to hash Color4 objects
|
694
|
+
*/
|
695
|
+
export function getHashCode(value: ReadonlyColor4): number;
|
696
|
+
/**
|
697
|
+
* Creates a Color4 copied from the current one
|
698
|
+
* @returns create mutable Color4
|
699
|
+
*/
|
700
|
+
export function clone(value: ReadonlyColor4): MutableColor4;
|
701
|
+
/**
|
702
|
+
* Copies the given Color4 values into the destination
|
703
|
+
* @param source - defines the source Color4 object
|
704
|
+
* @param dest - defines the destination Color4 object
|
705
|
+
* @returns
|
706
|
+
*/
|
707
|
+
export function copyFrom(source: ReadonlyColor4, dest: MutableColor4): void;
|
708
|
+
/**
|
709
|
+
* Copies the given float values into the current one
|
710
|
+
* @param r - defines the red component to read from
|
711
|
+
* @param g - defines the green component to read from
|
712
|
+
* @param b - defines the blue component to read from
|
713
|
+
* @param a - defines the alpha component to read from
|
714
|
+
* @returns the current updated Color4 object
|
715
|
+
*/
|
716
|
+
export function copyFromFloats(r: number, g: number, b: number, a: number, dest: MutableColor4): void;
|
717
|
+
/**
|
718
|
+
* Copies the given float values into the current one
|
719
|
+
* @param r - defines the red component to read from
|
720
|
+
* @param g - defines the green component to read from
|
721
|
+
* @param b - defines the blue component to read from
|
722
|
+
* @param a - defines the alpha component to read from
|
723
|
+
* @returns the current updated Color4 object
|
724
|
+
*/
|
725
|
+
export function set(r: number, g: number, b: number, a: number, dest: MutableColor4): void;
|
726
|
+
/**
|
727
|
+
* Compute the Color4 hexadecimal code as a string
|
728
|
+
* @returns a string containing the hexadecimal representation of the Color4 object
|
729
|
+
*/
|
730
|
+
export function toHexString(value: ReadonlyColor4): string;
|
731
|
+
/**
|
732
|
+
* Computes a Color4 converted from the current one to linear space
|
733
|
+
* @returns create mutable Color4
|
734
|
+
*/
|
735
|
+
export function toLinearSpace(value: ReadonlyColor4): MutableColor4;
|
736
|
+
/**
|
737
|
+
* Converts the Color4 values to linear space and stores the result in "convertedColor"
|
738
|
+
* @param convertedColor - defines the Color4 object where to store the linear space version
|
739
|
+
* @returns the unmodified Color4
|
740
|
+
*/
|
741
|
+
export function toLinearSpaceToRef(value: ReadonlyColor4, ref: MutableColor4): void;
|
742
|
+
/**
|
743
|
+
* Computes a Color4 converted from the current one to gamma space
|
744
|
+
* @returns create mutable Color4
|
745
|
+
*/
|
746
|
+
export function toGammaSpace(value: ReadonlyColor4): ReadonlyColor4;
|
747
|
+
/**
|
748
|
+
* Converts the Color4 values to gamma space and stores the result in "convertedColor"
|
749
|
+
* @param convertedColor - defines the Color4 object where to store the gamma space version
|
750
|
+
* @returns the unmodified Color4
|
751
|
+
*/
|
752
|
+
export function toGammaSpaceToRef(value: ReadonlyColor4, convertedColor: MutableColor4): void;
|
753
|
+
}
|
754
|
+
|
755
|
+
declare interface Color4_2 {
|
70
756
|
r: number;
|
71
757
|
g: number;
|
72
758
|
b: number;
|
@@ -785,7 +1471,7 @@ declare namespace Matrix {
|
|
785
1471
|
/**
|
786
1472
|
* Gets an identity matrix that must not be updated
|
787
1473
|
*/
|
788
|
-
function
|
1474
|
+
function IdentityReadonly(): ReadonlyMatrix;
|
789
1475
|
/**
|
790
1476
|
* Creates an empty matrix (filled with zeros)
|
791
1477
|
*/
|
@@ -1869,11 +2555,11 @@ declare interface PBAvatarShape {
|
|
1869
2555
|
/** default = urn:decentraland:off-chain:base-avatars:BaseFemale */
|
1870
2556
|
bodyShape?: string | undefined;
|
1871
2557
|
/** default = decentraland.common.Color3(R = 0.6f, G = 0.462f, B = 0.356f) */
|
1872
|
-
skinColor?:
|
2558
|
+
skinColor?: Color3_2 | undefined;
|
1873
2559
|
/** default = decentraland.common.Color3(R = 0.283f, G = 0.142f, B = 0f) */
|
1874
|
-
hairColor?:
|
2560
|
+
hairColor?: Color3_2 | undefined;
|
1875
2561
|
/** default = decentraland.common.Color3(R = 0.6f, G = 0.462f, B = 0.356f) */
|
1876
|
-
eyeColor?:
|
2562
|
+
eyeColor?: Color3_2 | undefined;
|
1877
2563
|
expressionTriggerId?: string | undefined;
|
1878
2564
|
/** default = timestamp */
|
1879
2565
|
expressionTriggerTimestamp?: number | undefined;
|
@@ -1927,11 +2613,11 @@ declare interface PBMaterial {
|
|
1927
2613
|
/** default = null */
|
1928
2614
|
bumpTexture?: PBMaterial_Texture | undefined;
|
1929
2615
|
/** default = white; */
|
1930
|
-
albedoColor?:
|
2616
|
+
albedoColor?: Color3_2 | undefined;
|
1931
2617
|
/** default = black; */
|
1932
|
-
emissiveColor?:
|
2618
|
+
emissiveColor?: Color3_2 | undefined;
|
1933
2619
|
/** default = white; */
|
1934
|
-
reflectivityColor?:
|
2620
|
+
reflectivityColor?: Color3_2 | undefined;
|
1935
2621
|
/** default = TransparencyMode.Auto */
|
1936
2622
|
transparencyMode?: MaterialTransparencyMode | undefined;
|
1937
2623
|
/** default = 0.5 */
|
@@ -2011,7 +2697,7 @@ declare interface PBNftShape {
|
|
2011
2697
|
/** default = PictureFrameStyle.Classic */
|
2012
2698
|
style?: NftFrameType | undefined;
|
2013
2699
|
/** default = decentraland.common.Color3(0.6404918, 0.611472, 0.8584906) */
|
2014
|
-
color?:
|
2700
|
+
color?: Color3_2 | undefined;
|
2015
2701
|
}
|
2016
2702
|
|
2017
2703
|
declare interface PBPointerEvents {
|
@@ -2096,22 +2782,22 @@ declare interface PBTextShape {
|
|
2096
2782
|
shadowOffsetY?: number | undefined;
|
2097
2783
|
outlineWidth?: number | undefined;
|
2098
2784
|
/** default=(1.0,1.0,1.0) */
|
2099
|
-
shadowColor?:
|
2785
|
+
shadowColor?: Color3_2 | undefined;
|
2100
2786
|
/** default=(1.0,1.0,1.0) */
|
2101
|
-
outlineColor?:
|
2787
|
+
outlineColor?: Color3_2 | undefined;
|
2102
2788
|
/** default=(1.0,1.0,1.0) */
|
2103
|
-
textColor?:
|
2789
|
+
textColor?: Color4_2 | undefined;
|
2104
2790
|
}
|
2105
2791
|
|
2106
2792
|
declare interface PBUiBackground {
|
2107
2793
|
/** default=(0.0, 0.0, 0.0, 0.0) */
|
2108
|
-
backgroundColor?:
|
2794
|
+
backgroundColor?: Color4_2 | undefined;
|
2109
2795
|
}
|
2110
2796
|
|
2111
2797
|
declare interface PBUiText {
|
2112
2798
|
value: string;
|
2113
2799
|
/** default=(1.0,1.0,1.0) */
|
2114
|
-
color?:
|
2800
|
+
color?: Color3_2 | undefined;
|
2115
2801
|
/** default='center' */
|
2116
2802
|
textAlign?: TextAlignMode | undefined;
|
2117
2803
|
/** default=0 */
|
@@ -2347,26 +3033,69 @@ declare function preEngine(): {
|
|
2347
3033
|
|
2348
3034
|
/**
|
2349
3035
|
* @public
|
3036
|
+
* Quaternion is a type and a namespace.
|
3037
|
+
* - The namespace contains all types and functions to operates with Quaternion
|
3038
|
+
* - The type Quaternion is an alias to Quaternion.ReadonlyQuaternion
|
3039
|
+
* ```
|
3040
|
+
*
|
3041
|
+
* // Namespace usage example
|
3042
|
+
* const next = Quaternion.add(pointA, velocityA)
|
3043
|
+
*
|
3044
|
+
* // Type usage example
|
3045
|
+
* const readonlyRotation: Quaternion = Quaternion.Zero()
|
3046
|
+
* readonlyRotation.x = 0.1 // this FAILS
|
3047
|
+
*
|
3048
|
+
* // For mutable usage, use `Quaternion.Mutable`
|
3049
|
+
* const rotation: Quaternion.Mutable = Quaternion.Identity()
|
3050
|
+
* rotation.x = 3.0 // this WORKS
|
3051
|
+
* ```
|
3052
|
+
*/
|
3053
|
+
export declare type Quaternion = Quaternion.ReadonlyQuaternion;
|
3054
|
+
|
3055
|
+
/**
|
3056
|
+
* @public
|
3057
|
+
* Quaternion is a type and a namespace.
|
3058
|
+
* ```
|
3059
|
+
* // The namespace contains all types and functions to operates with Quaternion
|
3060
|
+
* const next = Quaternion.add(pointA, velocityA)
|
3061
|
+
* // The type Quaternion is an alias to Quaternion.ReadonlyQuaternion
|
3062
|
+
* const readonlyRotation: Quaternion = Quaternion.Zero()
|
3063
|
+
* readonlyRotation.x = 0.1 // this FAILS
|
3064
|
+
*
|
3065
|
+
* // For mutable usage, use `Quaternion.Mutable`
|
3066
|
+
* const rotation: Quaternion.Mutable = Quaternion.Identity()
|
3067
|
+
* rotation.x = 3.0 // this WORKS
|
3068
|
+
* ```
|
2350
3069
|
*/
|
2351
3070
|
export declare namespace Quaternion {
|
2352
3071
|
/**
|
2353
3072
|
* @public
|
3073
|
+
* For external use, type with `Quaternion`, e.g. `const zeroRotation: Quaternion = Quaternion.Zero()`.
|
3074
|
+
* For mutable typing, use `Quaternion.Mutable`, e.g. `const identityQuaternion: Quaternion.Mutable = Quaternion.Identity()`.
|
3075
|
+
*/
|
3076
|
+
export type ReadonlyQuaternion = {
|
3077
|
+
readonly x: number;
|
3078
|
+
readonly y: number;
|
3079
|
+
readonly z: number;
|
3080
|
+
readonly w: number;
|
3081
|
+
};
|
3082
|
+
/**
|
3083
|
+
* @public
|
3084
|
+
* For external usage, type with `Quaternion`, e.g. `const zeroRotation: Quaternion = Quaternion.Zero()`.
|
3085
|
+
* For mutable typing, use `Quaternion.Mutable`, e.g. `const identityQuaternion: Quaternion.Mutable = Quaternion.Identity()`.
|
2354
3086
|
*/
|
2355
3087
|
export type MutableQuaternion = {
|
2356
|
-
y: number;
|
2357
3088
|
x: number;
|
3089
|
+
y: number;
|
2358
3090
|
z: number;
|
2359
3091
|
w: number;
|
2360
3092
|
};
|
2361
3093
|
/**
|
2362
3094
|
* @public
|
3095
|
+
* Type with `Quaternion` for readonly usage, e.g. `const zeroRotation: Quaternion = Quaternion.Zero()`.
|
3096
|
+
* For mutable, use `Quaternion.Mutable`, e.g. `const identityQuaternion: Quaternion.Mutable = Quaternion.Identity()`.
|
2363
3097
|
*/
|
2364
|
-
export type
|
2365
|
-
readonly y: number;
|
2366
|
-
readonly x: number;
|
2367
|
-
readonly z: number;
|
2368
|
-
readonly w: number;
|
2369
|
-
};
|
3098
|
+
export type Mutable = MutableQuaternion;
|
2370
3099
|
/**
|
2371
3100
|
* Creates a new Quaternion from the given floats
|
2372
3101
|
* @param x - defines the first component (0 by default)
|
@@ -2392,19 +3121,19 @@ export declare namespace Quaternion {
|
|
2392
3121
|
export function add(q1: ReadonlyQuaternion, q2: ReadonlyQuaternion): MutableQuaternion;
|
2393
3122
|
/**
|
2394
3123
|
* Creates a new rotation from the given Euler float angles (y, x, z) and stores it in the target quaternion
|
2395
|
-
* @param yaw - defines the rotation around Y axis
|
2396
|
-
* @param pitch - defines the rotation around X axis
|
2397
|
-
* @param roll - defines the rotation around Z axis
|
2398
|
-
* @
|
3124
|
+
* @param yaw - defines the rotation around Y axis (radians)
|
3125
|
+
* @param pitch - defines the rotation around X axis (radians)
|
3126
|
+
* @param roll - defines the rotation around Z axis (radians)
|
3127
|
+
* @returns result quaternion
|
2399
3128
|
*/
|
2400
|
-
export function
|
3129
|
+
export function fromRotationYawPitchRoll(yaw: number, pitch: number, roll: number): MutableQuaternion;
|
2401
3130
|
/**
|
2402
3131
|
* Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis.
|
2403
3132
|
* @param x - the rotation on the x axis in euler degrees
|
2404
3133
|
* @param y - the rotation on the y axis in euler degrees
|
2405
3134
|
* @param z - the rotation on the z axis in euler degrees
|
2406
3135
|
*/
|
2407
|
-
export function
|
3136
|
+
export function fromEulerDegress(x: number, y: number, z: number): MutableQuaternion;
|
2408
3137
|
/**
|
2409
3138
|
* Gets length of current quaternion
|
2410
3139
|
* @returns the quaternion length (float)
|
@@ -2426,6 +3155,7 @@ export declare namespace Quaternion {
|
|
2426
3155
|
* Returns the angle in degrees between two rotations a and b.
|
2427
3156
|
* @param quat1 - defines the first quaternion
|
2428
3157
|
* @param quat2 - defines the second quaternion
|
3158
|
+
* @returns the degress angle
|
2429
3159
|
*/
|
2430
3160
|
export function angle(quat1: ReadonlyQuaternion, quat2: ReadonlyQuaternion): number;
|
2431
3161
|
/**
|
@@ -2460,16 +3190,18 @@ export declare namespace Quaternion {
|
|
2460
3190
|
/**
|
2461
3191
|
* Gets or sets the euler angle representation of the rotation.
|
2462
3192
|
* Implemented unity-based calculations from: https://stackoverflow.com/a/56055813
|
3193
|
+
* @public
|
3194
|
+
* @returns a new Vector3 with euler angles degress
|
2463
3195
|
*/
|
2464
|
-
export function
|
3196
|
+
export function toEulerAngles(q: MutableQuaternion): Vector3.Mutable;
|
2465
3197
|
/**
|
2466
3198
|
* Creates a new rotation from the given Euler float angles (y, x, z) and stores it in the target quaternion
|
2467
|
-
* @param yaw - defines the rotation around Y axis
|
2468
|
-
* @param pitch - defines the rotation around X axis
|
2469
|
-
* @param roll - defines the rotation around Z axis
|
3199
|
+
* @param yaw - defines the rotation around Y axis (radians)
|
3200
|
+
* @param pitch - defines the rotation around X axis (radians)
|
3201
|
+
* @param roll - defines the rotation around Z axis (radians)
|
2470
3202
|
* @param result - defines the target quaternion
|
2471
3203
|
*/
|
2472
|
-
export function
|
3204
|
+
export function fromRotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion.MutableQuaternion): void;
|
2473
3205
|
/**
|
2474
3206
|
* Updates the given quaternion with the given rotation matrix values
|
2475
3207
|
* @param matrix - defines the source matrix
|
@@ -2507,7 +3239,13 @@ export declare namespace Quaternion {
|
|
2507
3239
|
* @returns the current quaternion
|
2508
3240
|
*/
|
2509
3241
|
export function multiplyToRef(self: ReadonlyQuaternion, q1: ReadonlyQuaternion, result: MutableQuaternion): void;
|
2510
|
-
|
3242
|
+
/**
|
3243
|
+
*
|
3244
|
+
* @param degress - the angle degress
|
3245
|
+
* @param axis - vector3
|
3246
|
+
* @returns a new Quaternion
|
3247
|
+
*/
|
3248
|
+
export function fromAngleAxis(degress: number, axis: Vector3.ReadonlyVector3): MutableQuaternion;
|
2511
3249
|
/**
|
2512
3250
|
* 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)
|
2513
3251
|
* @param axis1 - defines the first axis
|
@@ -2515,7 +3253,7 @@ export declare namespace Quaternion {
|
|
2515
3253
|
* @param axis3 - defines the third axis
|
2516
3254
|
* @returns the new quaternion
|
2517
3255
|
*/
|
2518
|
-
export function
|
3256
|
+
export function fromAxisToRotationQuaternion(axis1: Vector3.ReadonlyVector3, axis2: Vector3.ReadonlyVector3, axis3: Vector3.ReadonlyVector3): MutableQuaternion;
|
2519
3257
|
/**
|
2520
3258
|
* 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
|
2521
3259
|
* @param axis1 - defines the first axis
|
@@ -2523,11 +3261,21 @@ export declare namespace Quaternion {
|
|
2523
3261
|
* @param axis3 - defines the third axis
|
2524
3262
|
* @param ref - defines the target quaternion
|
2525
3263
|
*/
|
2526
|
-
export function
|
3264
|
+
export function fromAxisToRotationQuaternionToRef(axis1: Vector3.ReadonlyVector3, axis2: Vector3.ReadonlyVector3, axis3: Vector3.ReadonlyVector3, ref: MutableQuaternion): void;
|
2527
3265
|
/**
|
2528
3266
|
* Returns a zero filled quaternion
|
2529
3267
|
*/
|
2530
3268
|
export function Zero(): MutableQuaternion;
|
3269
|
+
/**
|
3270
|
+
* @public
|
3271
|
+
* Rotates the transform so the forward vector points at target's current position.
|
3272
|
+
*/
|
3273
|
+
export function fromLookAt(position: Vector3.ReadonlyVector3, target: Vector3.ReadonlyVector3, worldUp?: Vector3.ReadonlyVector3): MutableQuaternion;
|
3274
|
+
/**
|
3275
|
+
* @public
|
3276
|
+
* Rotates the transform so the forward vector points at target's current position.
|
3277
|
+
*/
|
3278
|
+
export function fromLookAtToRef(position: Vector3.ReadonlyVector3, target: Vector3.ReadonlyVector3, worldUp: Vector3.ReadonlyVector3 | undefined, result: MutableQuaternion): void;
|
2531
3279
|
}
|
2532
3280
|
|
2533
3281
|
/**
|
@@ -2587,6 +3335,198 @@ export declare type Result<T extends Spec> = ToOptional<{
|
|
2587
3335
|
[K in keyof T]: T[K] extends ISchema ? ReturnType<T[K]['deserialize']> : T[K] extends Spec ? Result<T[K]> : never;
|
2588
3336
|
}>;
|
2589
3337
|
|
3338
|
+
/**
|
3339
|
+
* Scalar computation library
|
3340
|
+
* @public
|
3341
|
+
*/
|
3342
|
+
export declare namespace Scalar {
|
3343
|
+
/**
|
3344
|
+
* Two pi constants convenient for computation.
|
3345
|
+
*/
|
3346
|
+
const TwoPi: number;
|
3347
|
+
/**
|
3348
|
+
* Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)
|
3349
|
+
* @param a - number
|
3350
|
+
* @param b - number
|
3351
|
+
* @param epsilon - (default = 1.401298E-45)
|
3352
|
+
* @returns true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)
|
3353
|
+
*/
|
3354
|
+
export function withinEpsilon(a: number, b: number, epsilon?: number): boolean;
|
3355
|
+
/**
|
3356
|
+
* Returns a string : the upper case translation of the number i to hexadecimal.
|
3357
|
+
* @param i - number
|
3358
|
+
* @returns the upper case translation of the number i to hexadecimal.
|
3359
|
+
*/
|
3360
|
+
export function toHex(i: number): string;
|
3361
|
+
/**
|
3362
|
+
* Returns -1 if value is negative and +1 is value is positive.
|
3363
|
+
* @param _value - the value
|
3364
|
+
* @returns the value itself if it's equal to zero.
|
3365
|
+
*/
|
3366
|
+
export function sign(value: number): number;
|
3367
|
+
/**
|
3368
|
+
* Returns the value itself if it's between min and max.
|
3369
|
+
* Returns min if the value is lower than min.
|
3370
|
+
* Returns max if the value is greater than max.
|
3371
|
+
* @param value - the value to clmap
|
3372
|
+
* @param min - the min value to clamp to (default: 0)
|
3373
|
+
* @param max - the max value to clamp to (default: 1)
|
3374
|
+
* @returns the clamped value
|
3375
|
+
*/
|
3376
|
+
export function clamp(value: number, min?: number, max?: number): number;
|
3377
|
+
/**
|
3378
|
+
* the log2 of value.
|
3379
|
+
* @param value - the value to compute log2 of
|
3380
|
+
* @returns the log2 of value.
|
3381
|
+
*/
|
3382
|
+
export function log2(value: number): number;
|
3383
|
+
/**
|
3384
|
+
* Loops the value, so that it is never larger than length and never smaller than 0.
|
3385
|
+
*
|
3386
|
+
* This is similar to the modulo operator but it works with floating point numbers.
|
3387
|
+
* For example, using 3.0 for t and 2.5 for length, the result would be 0.5.
|
3388
|
+
* With t = 5 and length = 2.5, the result would be 0.0.
|
3389
|
+
* Note, however, that the behaviour is not defined for negative numbers as it is for the modulo operator
|
3390
|
+
* @param value - the value
|
3391
|
+
* @param length - the length
|
3392
|
+
* @returns the looped value
|
3393
|
+
*/
|
3394
|
+
export function repeat(value: number, length: number): number;
|
3395
|
+
/**
|
3396
|
+
* Normalize the value between 0.0 and 1.0 using min and max values
|
3397
|
+
* @param value - value to normalize
|
3398
|
+
* @param min - max to normalize between
|
3399
|
+
* @param max - min to normalize between
|
3400
|
+
* @returns the normalized value
|
3401
|
+
*/
|
3402
|
+
export function normalize(value: number, min: number, max: number): number;
|
3403
|
+
/**
|
3404
|
+
* Denormalize the value from 0.0 and 1.0 using min and max values
|
3405
|
+
* @param normalized - value to denormalize
|
3406
|
+
* @param min - max to denormalize between
|
3407
|
+
* @param max - min to denormalize between
|
3408
|
+
* @returns the denormalized value
|
3409
|
+
*/
|
3410
|
+
export function denormalize(normalized: number, min: number, max: number): number;
|
3411
|
+
/**
|
3412
|
+
* Calculates the shortest difference between two given angles given in degrees.
|
3413
|
+
* @param current - current angle in degrees
|
3414
|
+
* @param target - target angle in degrees
|
3415
|
+
* @returns the delta
|
3416
|
+
*/
|
3417
|
+
export function deltaAngle(current: number, target: number): number;
|
3418
|
+
/**
|
3419
|
+
* PingPongs the value t, so that it is never larger than length and never smaller than 0.
|
3420
|
+
* @param tx - value
|
3421
|
+
* @param length - length
|
3422
|
+
* @returns The returned value will move back and forth between 0 and length
|
3423
|
+
*/
|
3424
|
+
export function pingPong(tx: number, length: number): number;
|
3425
|
+
/**
|
3426
|
+
* Interpolates between min and max with smoothing at the limits.
|
3427
|
+
*
|
3428
|
+
* This export function interpolates between min and max in a similar way to Lerp. However, the interpolation will gradually speed up
|
3429
|
+
* from the start and slow down toward the end. This is useful for creating natural-looking animation, fading and other transitions.
|
3430
|
+
* @param from - from
|
3431
|
+
* @param to - to
|
3432
|
+
* @param tx - value
|
3433
|
+
* @returns the smooth stepped value
|
3434
|
+
*/
|
3435
|
+
export function smoothStep(from: number, to: number, tx: number): number;
|
3436
|
+
/**
|
3437
|
+
* Moves a value current towards target.
|
3438
|
+
*
|
3439
|
+
* This is essentially the same as Mathf.Lerp but instead the export function will ensure that the speed never exceeds maxDelta.
|
3440
|
+
* Negative values of maxDelta pushes the value away from target.
|
3441
|
+
* @param current - current value
|
3442
|
+
* @param target - target value
|
3443
|
+
* @param maxDelta - max distance to move
|
3444
|
+
* @returns resulting value
|
3445
|
+
*/
|
3446
|
+
export function moveTowards(current: number, target: number, maxDelta: number): number;
|
3447
|
+
/**
|
3448
|
+
* Same as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees.
|
3449
|
+
*
|
3450
|
+
* Variables current and target are assumed to be in degrees. For optimization reasons, negative values of maxDelta
|
3451
|
+
* are not supported and may cause oscillation. To push current away from a target angle, add 180 to that angle instead.
|
3452
|
+
* @param current - current value
|
3453
|
+
* @param target - target value
|
3454
|
+
* @param maxDelta - max distance to move
|
3455
|
+
* @returns resulting angle
|
3456
|
+
*/
|
3457
|
+
export function moveTowardsAngle(current: number, target: number, maxDelta: number): number;
|
3458
|
+
/**
|
3459
|
+
* Creates a new scalar with values linearly interpolated of "amount" between the start scalar and the end scalar
|
3460
|
+
* @param start - start value
|
3461
|
+
* @param end - target value
|
3462
|
+
* @param amount - amount to lerp between
|
3463
|
+
* @returns the lerped value
|
3464
|
+
*/
|
3465
|
+
export function lerp(start: number, end: number, amount: number): number;
|
3466
|
+
/**
|
3467
|
+
* Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.
|
3468
|
+
* The parameter t is clamped to the range [0, 1]. Variables a and b are assumed to be in degrees.
|
3469
|
+
* @param start - start value
|
3470
|
+
* @param end - target value
|
3471
|
+
* @param amount - amount to lerp between
|
3472
|
+
* @returns the lerped value
|
3473
|
+
*/
|
3474
|
+
export function lerpAngle(start: number, end: number, amount: number): number;
|
3475
|
+
/**
|
3476
|
+
* Calculates the linear parameter t that produces the interpolant value within the range [a, b].
|
3477
|
+
* @param a - start value
|
3478
|
+
* @param b - target value
|
3479
|
+
* @param value - value between a and b
|
3480
|
+
* @returns the inverseLerp value
|
3481
|
+
*/
|
3482
|
+
export function inverseLerp(a: number, b: number, value: number): number;
|
3483
|
+
/**
|
3484
|
+
* Returns a new scalar located for "amount" (float) on the Hermite spline defined by the scalars "value1", "value3", "tangent1", "tangent2".
|
3485
|
+
* {@link http://mathworld.wolfram.com/HermitePolynomial.html}
|
3486
|
+
* @param value1 - spline value
|
3487
|
+
* @param tangent1 - spline value
|
3488
|
+
* @param value2 - spline value
|
3489
|
+
* @param tangent2 - spline value
|
3490
|
+
* @param amount - input value
|
3491
|
+
* @returns hermite result
|
3492
|
+
*/
|
3493
|
+
export function hermite(value1: number, tangent1: number, value2: number, tangent2: number, amount: number): number;
|
3494
|
+
/**
|
3495
|
+
* Returns a random float number between and min and max values
|
3496
|
+
* @param min - min value of random
|
3497
|
+
* @param max - max value of random
|
3498
|
+
* @returns random value
|
3499
|
+
*/
|
3500
|
+
export function randomRange(min: number, max: number): number;
|
3501
|
+
/**
|
3502
|
+
* This export function returns percentage of a number in a given range.
|
3503
|
+
*
|
3504
|
+
* RangeToPercent(40,20,60) will return 0.5 (50%)
|
3505
|
+
* RangeToPercent(34,0,100) will return 0.34 (34%)
|
3506
|
+
* @param num - to convert to percentage
|
3507
|
+
* @param min - min range
|
3508
|
+
* @param max - max range
|
3509
|
+
* @returns the percentage
|
3510
|
+
*/
|
3511
|
+
export function rangeToPercent(num: number, min: number, max: number): number;
|
3512
|
+
/**
|
3513
|
+
* This export function returns number that corresponds to the percentage in a given range.
|
3514
|
+
*
|
3515
|
+
* PercentToRange(0.34,0,100) will return 34.
|
3516
|
+
* @param percent - to convert to number
|
3517
|
+
* @param min - min range
|
3518
|
+
* @param max - max range
|
3519
|
+
* @returns the number
|
3520
|
+
*/
|
3521
|
+
export function percentToRange(percent: number, min: number, max: number): number;
|
3522
|
+
/**
|
3523
|
+
* Returns the angle converted to equivalent value between -Math.PI and Math.PI radians.
|
3524
|
+
* @param angle - The angle to normalize in radian.
|
3525
|
+
* @returns The converted angle.
|
3526
|
+
*/
|
3527
|
+
export function normalizeRadians(angle: number): number;
|
3528
|
+
}
|
3529
|
+
|
2590
3530
|
/**
|
2591
3531
|
* @public
|
2592
3532
|
*/
|
@@ -2707,10 +3647,55 @@ export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
|
|
2707
3647
|
|
2708
3648
|
/**
|
2709
3649
|
* @public
|
3650
|
+
* Vector3 is a type and a namespace.
|
3651
|
+
* - The namespace contains all types and functions to operates with Vector3
|
3652
|
+
* - The type Vector3 is an alias to Vector3.ReadonlyVector3
|
3653
|
+
* ```
|
3654
|
+
*
|
3655
|
+
* // Namespace usage example
|
3656
|
+
* const next = Vector3.add(pointA, velocityA)
|
3657
|
+
*
|
3658
|
+
* // Type usage example
|
3659
|
+
* const readonlyPosition: Vector3 = Vector3.Zero()
|
3660
|
+
* readonlyPosition.x = 0.1 // this FAILS
|
3661
|
+
*
|
3662
|
+
* // For mutable usage, use `Vector3.Mutable`
|
3663
|
+
* const position: Vector3.Mutable = Vector3.One()
|
3664
|
+
* position.x = 3.0 // this WORKS
|
3665
|
+
* ```
|
3666
|
+
*/
|
3667
|
+
export declare type Vector3 = Vector3.ReadonlyVector3;
|
3668
|
+
|
3669
|
+
/**
|
3670
|
+
* @public
|
3671
|
+
* Vector3 is a type and a namespace.
|
3672
|
+
* ```
|
3673
|
+
* // The namespace contains all types and functions to operates with Vector3
|
3674
|
+
* const next = Vector3.add(pointA, velocityA)
|
3675
|
+
* // The type Vector3 is an alias to Vector3.ReadonlyVector3
|
3676
|
+
* const readonlyPosition: Vector3 = Vector3.Zero()
|
3677
|
+
* readonlyPosition.x = 0.1 // this FAILS
|
3678
|
+
*
|
3679
|
+
* // For mutable usage, use `Vector3.Mutable`
|
3680
|
+
* const position: Vector3.Mutable = Vector3.One()
|
3681
|
+
* position.x = 3.0 // this WORKS
|
3682
|
+
* ```
|
2710
3683
|
*/
|
2711
3684
|
export declare namespace Vector3 {
|
2712
3685
|
/**
|
2713
3686
|
* @public
|
3687
|
+
* For external use, type with `Vector3`, e.g. `const zeroPosition: Vector3 = Vector3.Zero()`.
|
3688
|
+
* For mutable typing, use `Vector3.Mutable`, e.g. `const upVector: Vector3.Mutable = Vector3.Up()`.
|
3689
|
+
*/
|
3690
|
+
export type ReadonlyVector3 = {
|
3691
|
+
readonly x: number;
|
3692
|
+
readonly y: number;
|
3693
|
+
readonly z: number;
|
3694
|
+
};
|
3695
|
+
/**
|
3696
|
+
* @public
|
3697
|
+
* For external usage, type with `Vector3`, e.g. `const zeroPosition: Vector3 = Vector3.Zero()`.
|
3698
|
+
* For mutable typing, use `Vector3.Mutable`, e.g. `const upVector: Vector3.Mutable = Vector3.Up()`.
|
2714
3699
|
*/
|
2715
3700
|
export type MutableVector3 = {
|
2716
3701
|
x: number;
|
@@ -2719,12 +3704,10 @@ export declare namespace Vector3 {
|
|
2719
3704
|
};
|
2720
3705
|
/**
|
2721
3706
|
* @public
|
3707
|
+
* Type with `Vector3` for readonly usage, e.g. `const zeroPosition: Vector3 = Vector3.Zero()`.
|
3708
|
+
* For mutable, use `Vector3.Mutable`, e.g. `const upVector: Vector3.Mutable = Vector3.Up()`.
|
2722
3709
|
*/
|
2723
|
-
export type
|
2724
|
-
readonly x: number;
|
2725
|
-
readonly y: number;
|
2726
|
-
readonly z: number;
|
2727
|
-
};
|
3710
|
+
export type Mutable = MutableVector3;
|
2728
3711
|
/**
|
2729
3712
|
* Gets a boolean indicating that the vector is non uniform meaning x, y or z are not all the same
|
2730
3713
|
* @param vector - vector to check
|
@@ -2789,7 +3772,7 @@ export declare namespace Vector3 {
|
|
2789
3772
|
* Copy source into dest
|
2790
3773
|
*
|
2791
3774
|
*/
|
2792
|
-
export function
|
3775
|
+
export function copyFrom(source: ReadonlyVector3, dest: MutableVector3): void;
|
2793
3776
|
/**
|
2794
3777
|
* Sets the given vector "dest" with the given floats.
|
2795
3778
|
* @param x - defines the x coordinate of the source
|
@@ -2852,7 +3835,7 @@ export declare namespace Vector3 {
|
|
2852
3835
|
export function fromFloatArrayToRef(array: FloatArray, offset: number, result: MutableVector3): void;
|
2853
3836
|
/**
|
2854
3837
|
* Gets the length of the Vector3
|
2855
|
-
* @returns the length of the
|
3838
|
+
* @returns the length of the Vector3
|
2856
3839
|
*/
|
2857
3840
|
export function length(vector: ReadonlyVector3): number;
|
2858
3841
|
/**
|