@dcl/sdk 7.0.0-2536021667.commit-17c845c
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/LICENSE +201 -0
- package/dist/ecs7/index.d.ts +1721 -0
- package/dist/ecs7/index.js +6173 -0
- package/dist/ecs7/index.min.js +1 -0
- package/dist/ecs7/index.min.js.map +1 -0
- package/dist/ecs7/proto-definitions/AudioSource.proto +13 -0
- package/dist/ecs7/proto-definitions/AudioStream.proto +10 -0
- package/dist/ecs7/proto-definitions/BoxShape.proto +11 -0
- package/dist/ecs7/proto-definitions/CylinderShape.proto +12 -0
- package/dist/ecs7/proto-definitions/NFTShape.proto +16 -0
- package/dist/ecs7/proto-definitions/PlaneShape.proto +11 -0
- package/dist/ecs7/proto-definitions/README.md +32 -0
- package/dist/ecs7/proto-definitions/SphereShape.proto +10 -0
- package/dist/ecs7/proto-definitions/TextShape.proto +33 -0
- package/dist/ecs7/proto-definitions/Transform.md +25 -0
- package/dist/ecs7/proto-definitions/common/Color3.proto +8 -0
- package/dist/ecs7/proto-definitions/common/id.md +2 -0
- package/dist/ecs7/proto-definitions/common/id.proto +7 -0
- package/package.json +42 -0
- package/src/cli/mock-catalyst/index.js +170 -0
- package/src/cli/setupUtils.js +345 -0
- package/src/cli/wearables.js +145 -0
- package/src/setupExport.js +43 -0
- package/src/setupProxy.js +165 -0
- package/types/@decentraland/CommunicationsController/index.d.ts +7 -0
- package/types/@decentraland/EnvironmentAPI/index.d.ts +45 -0
- package/types/@decentraland/EthereumController/index.d.ts +47 -0
- package/types/@decentraland/Identity/index.d.ts +42 -0
- package/types/@decentraland/ParcelIdentity/index.d.ts +49 -0
- package/types/@decentraland/Players/index.d.ts +47 -0
- package/types/@decentraland/PortableExperiences/index.d.ts +39 -0
- package/types/@decentraland/RestrictedActions/index.d.ts +41 -0
- package/types/@decentraland/SignedFetch/index.d.ts +16 -0
- package/types/@decentraland/SocialController/index.d.ts +1 -0
- package/types/@decentraland/web3-provider/index.d.ts +7 -0
- package/types/dcl/decentraland-ecs.api.json +61732 -0
- package/types/dcl/decentraland-ecs.api.md +2717 -0
- package/types/ecs7/index.d.ts +1721 -0
- package/types/ecs7-env/es2015.iterable.d.ts +486 -0
- package/types/ecs7-env/es2015.symbol.d.ts +46 -0
- package/types/ecs7-env/index.d.ts +19 -0
- package/types/env/es5.d.ts +4565 -0
- package/types/env/index.d.ts +411 -0
- package/types/tsconfig.ecs7.json +27 -0
- package/types/tsconfig.ecs7.strict.json +13 -0
@@ -0,0 +1,1721 @@
|
|
1
|
+
/**
|
2
|
+
* @public
|
3
|
+
*/
|
4
|
+
export declare function ArrayType<T>(type: EcsType<T>): EcsType<Array<T>>;
|
5
|
+
|
6
|
+
/**
|
7
|
+
* @public
|
8
|
+
*/
|
9
|
+
export declare type ByteBuffer = ReturnType<typeof createByteBuffer>;
|
10
|
+
|
11
|
+
declare interface Color3 {
|
12
|
+
r: number;
|
13
|
+
g: number;
|
14
|
+
b: number;
|
15
|
+
}
|
16
|
+
|
17
|
+
/**
|
18
|
+
* @public
|
19
|
+
*/
|
20
|
+
export declare type ComponentDefinition<T extends EcsType = EcsType<any>> = {
|
21
|
+
_id: number;
|
22
|
+
has(entity: Entity): boolean;
|
23
|
+
getFrom(entity: Entity): DeepReadonly<ComponentType<T>>;
|
24
|
+
getOrNull(entity: Entity): DeepReadonly<ComponentType<T>> | null;
|
25
|
+
create(entity: Entity, val: ComponentType<T>): ComponentType<T>;
|
26
|
+
mutable(entity: Entity): ComponentType<T>;
|
27
|
+
createOrReplace(entity: Entity, val: ComponentType<T>): ComponentType<T>;
|
28
|
+
deleteFrom(entity: Entity): ComponentType<T> | null;
|
29
|
+
upsertFromBinary(entity: Entity, data: ByteBuffer): ComponentType<T> | null;
|
30
|
+
updateFromBinary(entity: Entity, data: ByteBuffer): ComponentType<T> | null;
|
31
|
+
toBinary(entity: Entity): ByteBuffer;
|
32
|
+
writeToByteBuffer(entity: Entity, buffer: ByteBuffer): void;
|
33
|
+
iterator(): Iterable<[Entity, ComponentType<T>]>;
|
34
|
+
dirtyIterator(): Iterable<Entity>;
|
35
|
+
clearDirty(): void;
|
36
|
+
isDirty(entity: Entity): boolean;
|
37
|
+
};
|
38
|
+
|
39
|
+
/**
|
40
|
+
* @public
|
41
|
+
*/
|
42
|
+
export declare type ComponentEcsType<T extends [ComponentDefinition, ...ComponentDefinition[]]> = {
|
43
|
+
[K in keyof T]: T[K] extends ComponentDefinition ? ReturnType<T[K]['mutable']> : never;
|
44
|
+
};
|
45
|
+
|
46
|
+
/**
|
47
|
+
* @public
|
48
|
+
*/
|
49
|
+
export declare type ComponentType<T extends EcsType> = EcsResult<T>;
|
50
|
+
|
51
|
+
/**
|
52
|
+
* ByteBuffer is a wrapper of DataView which also adds a read and write offset.
|
53
|
+
* Also in a write operation it resizes the buffer is being used if it needs.
|
54
|
+
*
|
55
|
+
* - Use read and write function to generate or consume data.
|
56
|
+
* - Use set and get only if you are sure that you're doing.
|
57
|
+
*/
|
58
|
+
declare function createByteBuffer(options?: CreateByteBufferOptions): {
|
59
|
+
/**
|
60
|
+
* @returns The entire current Uint8Array.
|
61
|
+
*
|
62
|
+
* WARNING: if the buffer grows, the view had changed itself,
|
63
|
+
* and the reference will be a invalid one.
|
64
|
+
*/
|
65
|
+
buffer(): Uint8Array;
|
66
|
+
/**
|
67
|
+
* @returns The capacity of the current buffer
|
68
|
+
*/
|
69
|
+
bufferLength(): number;
|
70
|
+
/**
|
71
|
+
* Resets byteBuffer to avoid creating a new one
|
72
|
+
*/
|
73
|
+
resetBuffer(): void;
|
74
|
+
/**
|
75
|
+
* @returns The current read offset
|
76
|
+
*/
|
77
|
+
currentReadOffset(): number;
|
78
|
+
/**
|
79
|
+
* @returns The current write offset
|
80
|
+
*/
|
81
|
+
currentWriteOffset(): number;
|
82
|
+
/**
|
83
|
+
* Reading purpose
|
84
|
+
* Returns the previuos offsset size before incrementing
|
85
|
+
*/
|
86
|
+
incrementReadOffset(amount: number): number;
|
87
|
+
/**
|
88
|
+
* @returns How many bytes are available to read.
|
89
|
+
*/
|
90
|
+
remainingBytes(): number;
|
91
|
+
readFloat32(): number;
|
92
|
+
readFloat64(): number;
|
93
|
+
readInt8(): number;
|
94
|
+
readInt16(): number;
|
95
|
+
readInt32(): number;
|
96
|
+
readInt64(): bigint;
|
97
|
+
readUint8(): number;
|
98
|
+
readUint16(): number;
|
99
|
+
readUint32(): number;
|
100
|
+
readUint64(): bigint;
|
101
|
+
readBuffer(): Uint8Array;
|
102
|
+
/**
|
103
|
+
* Writing purpose
|
104
|
+
*/
|
105
|
+
/**
|
106
|
+
* Increment offset
|
107
|
+
* @param amount - how many bytes
|
108
|
+
* @returns The offset when this reserving starts.
|
109
|
+
*/
|
110
|
+
incrementWriteOffset(amount: number): number;
|
111
|
+
/**
|
112
|
+
* @returns The total number of bytes writen in the buffer.
|
113
|
+
*/
|
114
|
+
size(): number;
|
115
|
+
/**
|
116
|
+
* @returns The subarray from 0 to offset.
|
117
|
+
*/
|
118
|
+
toBinary(): Uint8Array;
|
119
|
+
writeBuffer(value: Uint8Array, writeLength?: boolean): void;
|
120
|
+
writeFloat32(value: number): void;
|
121
|
+
writeFloat64(value: number): void;
|
122
|
+
writeInt8(value: number): void;
|
123
|
+
writeInt16(value: number): void;
|
124
|
+
writeInt32(value: number): void;
|
125
|
+
writeInt64(value: bigint): void;
|
126
|
+
writeUint8(value: number): void;
|
127
|
+
writeUint16(value: number): void;
|
128
|
+
writeUint32(value: number): void;
|
129
|
+
writeUint64(value: bigint): void;
|
130
|
+
getFloat32(offset: number): number;
|
131
|
+
getFloat64(offset: number): number;
|
132
|
+
getInt8(offset: number): number;
|
133
|
+
getInt16(offset: number): number;
|
134
|
+
getInt32(offset: number): number;
|
135
|
+
getInt64(offset: number): bigint;
|
136
|
+
getUint8(offset: number): number;
|
137
|
+
getUint16(offset: number): number;
|
138
|
+
getUint32(offset: number): number;
|
139
|
+
getUint64(offset: number): bigint;
|
140
|
+
setFloat32(offset: number, value: number): void;
|
141
|
+
setFloat64(offset: number, value: number): void;
|
142
|
+
setInt8(offset: number, value: number): void;
|
143
|
+
setInt16(offset: number, value: number): void;
|
144
|
+
setInt32(offset: number, value: number): void;
|
145
|
+
setInt64(offset: number, value: bigint): void;
|
146
|
+
setUint8(offset: number, value: number): void;
|
147
|
+
setUint16(offset: number, value: number): void;
|
148
|
+
setUint32(offset: number, value: number): void;
|
149
|
+
setUint64(offset: number, value: bigint): void;
|
150
|
+
};
|
151
|
+
|
152
|
+
/**
|
153
|
+
* @param writing - writing option, see object specs.
|
154
|
+
* @param reading - reading option, see object specs.
|
155
|
+
* @param initialCapacity - Initial capacity of buffer to allocate, ignored if you use writing or reading options
|
156
|
+
*/
|
157
|
+
declare interface CreateByteBufferOptions {
|
158
|
+
/**
|
159
|
+
* @param buffer - a buffer already allocated to read from there.
|
160
|
+
* @param currentOffset - set the cursor where begins to read. Default 0
|
161
|
+
* @param length - delimite where the valid data ends. Default: buffer.length
|
162
|
+
*/
|
163
|
+
reading?: {
|
164
|
+
buffer: Uint8Array;
|
165
|
+
length?: number;
|
166
|
+
currentOffset: number;
|
167
|
+
};
|
168
|
+
/**
|
169
|
+
* @param buffer - a buffer already allocated to write there.
|
170
|
+
* @param currentOffset - set the cursor to not start writing from the begin of it. Default 0
|
171
|
+
*/
|
172
|
+
writing?: {
|
173
|
+
buffer: Uint8Array;
|
174
|
+
currentOffset?: number;
|
175
|
+
};
|
176
|
+
initialCapacity?: number;
|
177
|
+
}
|
178
|
+
|
179
|
+
/**
|
180
|
+
* Make each field readonly deeply
|
181
|
+
* @public
|
182
|
+
*/
|
183
|
+
export declare type DeepReadonly<T> = {
|
184
|
+
readonly [P in keyof T]: DeepReadonly<T[P]>;
|
185
|
+
};
|
186
|
+
|
187
|
+
declare function defineSdkComponents(engine: Pick<IEngine, 'defineComponent'>): {
|
188
|
+
AudioSource: ComponentDefinition<EcsType<PBAudioSource>>;
|
189
|
+
AudioStream: ComponentDefinition<EcsType<PBAudioStream>>;
|
190
|
+
BoxShape: ComponentDefinition<EcsType<PBBoxShape>>;
|
191
|
+
CylinderShape: ComponentDefinition<EcsType<PBCylinderShape>>;
|
192
|
+
NFTShape: ComponentDefinition<EcsType<PBNFTShape>>;
|
193
|
+
PlaneShape: ComponentDefinition<EcsType<PBPlaneShape>>;
|
194
|
+
SphereShape: ComponentDefinition<EcsType<PBSphereShape>>;
|
195
|
+
TextShape: ComponentDefinition<EcsType<PBTextShape>>;
|
196
|
+
Transform: ComponentDefinition<EcsType<Transform>>;
|
197
|
+
};
|
198
|
+
|
199
|
+
/**
|
200
|
+
* Constant used to convert from Euler degrees to radians
|
201
|
+
* @public
|
202
|
+
*/
|
203
|
+
export declare const DEG2RAD: number;
|
204
|
+
|
205
|
+
/** @public */
|
206
|
+
export declare type double = number;
|
207
|
+
|
208
|
+
/**
|
209
|
+
* @public
|
210
|
+
*/
|
211
|
+
export declare const EcsBoolean: EcsType<boolean>;
|
212
|
+
|
213
|
+
/**
|
214
|
+
* @public
|
215
|
+
*/
|
216
|
+
declare type EcsResult<T extends EcsType> = T extends EcsType ? ReturnType<T['deserialize']> : never;
|
217
|
+
|
218
|
+
/**
|
219
|
+
* @public
|
220
|
+
*/
|
221
|
+
export declare const EcsString: EcsType<string>;
|
222
|
+
|
223
|
+
/**
|
224
|
+
* @public
|
225
|
+
*/
|
226
|
+
export declare type EcsType<T = any> = {
|
227
|
+
serialize(value: T, builder: ByteBuffer): void;
|
228
|
+
deserialize(reader: ByteBuffer): T;
|
229
|
+
};
|
230
|
+
|
231
|
+
/**
|
232
|
+
* @public
|
233
|
+
*/
|
234
|
+
export declare function Engine(): IEngine;
|
235
|
+
|
236
|
+
/**
|
237
|
+
* @public
|
238
|
+
*/
|
239
|
+
export declare type Entity = number & {
|
240
|
+
[entitySymbol]: true;
|
241
|
+
};
|
242
|
+
|
243
|
+
declare const entitySymbol: unique symbol;
|
244
|
+
|
245
|
+
/**
|
246
|
+
* @public
|
247
|
+
*/
|
248
|
+
export declare function Enum<T>(type: EcsType<any>): EcsType<T>;
|
249
|
+
|
250
|
+
/**
|
251
|
+
* Constant used to define the minimal number value in Babylon.js
|
252
|
+
* @public
|
253
|
+
*/
|
254
|
+
export declare const Epsilon = 0.000001;
|
255
|
+
|
256
|
+
/** Excludes property keys from T where the property is assignable to U */
|
257
|
+
declare type ExcludeUndefined<T> = {
|
258
|
+
[P in keyof T]: undefined extends T[P] ? never : P;
|
259
|
+
}[keyof T];
|
260
|
+
|
261
|
+
/**
|
262
|
+
* @public
|
263
|
+
*/
|
264
|
+
export declare const FlatString: EcsType<string>;
|
265
|
+
|
266
|
+
/** @public */
|
267
|
+
export declare type float = number;
|
268
|
+
|
269
|
+
/**
|
270
|
+
* @public
|
271
|
+
*/
|
272
|
+
export declare const Float32: EcsType<number>;
|
273
|
+
|
274
|
+
/**
|
275
|
+
* @public
|
276
|
+
*/
|
277
|
+
export declare const Float64: EcsType<number>;
|
278
|
+
|
279
|
+
/** @public */
|
280
|
+
export declare type FloatArray = number[];
|
281
|
+
|
282
|
+
/**
|
283
|
+
* @public
|
284
|
+
*/
|
285
|
+
export declare type IEngine = {
|
286
|
+
addEntity(dynamic?: boolean): Entity;
|
287
|
+
addDynamicEntity(): Entity;
|
288
|
+
removeEntity(entity: Entity): void;
|
289
|
+
addSystem(system: Update): void;
|
290
|
+
defineComponent<T extends EcsType>(componentId: number, spec: T): ComponentDefinition<T>;
|
291
|
+
mutableGroupOf<T extends [ComponentDefinition, ...ComponentDefinition[]]>(...components: T): Iterable<[Entity, ...ComponentEcsType<T>]>;
|
292
|
+
groupOf<T extends [ComponentDefinition, ...ComponentDefinition[]]>(...components: T): Iterable<[Entity, ...DeepReadonly<ComponentEcsType<T>>]>;
|
293
|
+
getComponent<T extends EcsType>(componentId: number): ComponentDefinition<T>;
|
294
|
+
update(dt: number): void;
|
295
|
+
baseComponents: SdkComponetns;
|
296
|
+
};
|
297
|
+
|
298
|
+
/** Include property keys from T where the property is assignable to U */
|
299
|
+
declare type IncludeUndefined<T> = {
|
300
|
+
[P in keyof T]: undefined extends T[P] ? P : never;
|
301
|
+
}[keyof T];
|
302
|
+
|
303
|
+
/**
|
304
|
+
* @public
|
305
|
+
*/
|
306
|
+
export declare const Int16: EcsType<number>;
|
307
|
+
|
308
|
+
/**
|
309
|
+
* @public
|
310
|
+
*/
|
311
|
+
export declare const Int32: EcsType<number>;
|
312
|
+
|
313
|
+
/**
|
314
|
+
* @public
|
315
|
+
*/
|
316
|
+
export declare const Int64: EcsType<number>;
|
317
|
+
|
318
|
+
/**
|
319
|
+
* @public
|
320
|
+
*/
|
321
|
+
export declare const Int8: EcsType<number>;
|
322
|
+
|
323
|
+
/**
|
324
|
+
* Interface for the size containing width and height
|
325
|
+
* @public
|
326
|
+
*/
|
327
|
+
export declare interface ISize {
|
328
|
+
/**
|
329
|
+
* Width
|
330
|
+
*/
|
331
|
+
width: number;
|
332
|
+
/**
|
333
|
+
* Heighht
|
334
|
+
*/
|
335
|
+
height: number;
|
336
|
+
}
|
337
|
+
|
338
|
+
/**
|
339
|
+
* @public
|
340
|
+
*/
|
341
|
+
export declare function MapType<T extends Spec>(spec: T): EcsType<Result<T>>;
|
342
|
+
|
343
|
+
/**
|
344
|
+
* Class used to store matrix data (4x4)
|
345
|
+
* @public
|
346
|
+
*/
|
347
|
+
declare namespace Matrix {
|
348
|
+
type Matrix4x4 = [
|
349
|
+
number,
|
350
|
+
number,
|
351
|
+
number,
|
352
|
+
number,
|
353
|
+
number,
|
354
|
+
number,
|
355
|
+
number,
|
356
|
+
number,
|
357
|
+
number,
|
358
|
+
number,
|
359
|
+
number,
|
360
|
+
number,
|
361
|
+
number,
|
362
|
+
number,
|
363
|
+
number,
|
364
|
+
number
|
365
|
+
];
|
366
|
+
type MutableMatrix = {
|
367
|
+
/**
|
368
|
+
* Gets the update flag of the matrix which is an unique number for the matrix.
|
369
|
+
* It will be incremented every time the matrix data change.
|
370
|
+
* You can use it to speed the comparison between two versions of the same matrix.
|
371
|
+
*/
|
372
|
+
updateFlag: number;
|
373
|
+
isIdentity: boolean;
|
374
|
+
isIdentity3x2: boolean;
|
375
|
+
_isIdentityDirty: boolean;
|
376
|
+
_isIdentity3x2Dirty: boolean;
|
377
|
+
_m: Matrix4x4;
|
378
|
+
};
|
379
|
+
type ReadonlyMatrix = DeepReadonly<MutableMatrix>;
|
380
|
+
/**
|
381
|
+
* Gets the internal data of the matrix
|
382
|
+
*/
|
383
|
+
function m(self: MutableMatrix): Readonly<Matrix4x4>;
|
384
|
+
/**
|
385
|
+
* Gets an identity matrix that must not be updated
|
386
|
+
*/
|
387
|
+
function IdentityReadOnly(): ReadonlyMatrix;
|
388
|
+
/**
|
389
|
+
* Creates an empty matrix (filled with zeros)
|
390
|
+
*/
|
391
|
+
function create(): MutableMatrix;
|
392
|
+
/**
|
393
|
+
* Creates a matrix from an array
|
394
|
+
* @param array - defines the source array
|
395
|
+
* @param offset - defines an offset in the source array
|
396
|
+
* @returns a new Matrix set from the starting index of the given array
|
397
|
+
*/
|
398
|
+
function fromArray(array: ArrayLike<number>, offset?: number): MutableMatrix;
|
399
|
+
/**
|
400
|
+
* Copy the content of an array into a given matrix
|
401
|
+
* @param array - defines the source array
|
402
|
+
* @param offset - defines an offset in the source array
|
403
|
+
* @param result - defines the target matrix
|
404
|
+
*/
|
405
|
+
function fromArrayToRef(array: ArrayLike<number>, offset: number, result: MutableMatrix): void;
|
406
|
+
/**
|
407
|
+
* Stores an array into a matrix after having multiplied each component by a given factor
|
408
|
+
* @param array - defines the source array
|
409
|
+
* @param offset - defines the offset in the source array
|
410
|
+
* @param scale - defines the scaling factor
|
411
|
+
* @param result - defines the target matrix
|
412
|
+
*/
|
413
|
+
function fromFloatArrayToRefScaled(array: FloatArray, offset: number, scale: number, result: MutableMatrix): void;
|
414
|
+
/**
|
415
|
+
* Stores a list of values (16) inside a given matrix
|
416
|
+
* @param initialM11 - defines 1st value of 1st row
|
417
|
+
* @param initialM12 - defines 2nd value of 1st row
|
418
|
+
* @param initialM13 - defines 3rd value of 1st row
|
419
|
+
* @param initialM14 - defines 4th value of 1st row
|
420
|
+
* @param initialM21 - defines 1st value of 2nd row
|
421
|
+
* @param initialM22 - defines 2nd value of 2nd row
|
422
|
+
* @param initialM23 - defines 3rd value of 2nd row
|
423
|
+
* @param initialM24 - defines 4th value of 2nd row
|
424
|
+
* @param initialM31 - defines 1st value of 3rd row
|
425
|
+
* @param initialM32 - defines 2nd value of 3rd row
|
426
|
+
* @param initialM33 - defines 3rd value of 3rd row
|
427
|
+
* @param initialM34 - defines 4th value of 3rd row
|
428
|
+
* @param initialM41 - defines 1st value of 4th row
|
429
|
+
* @param initialM42 - defines 2nd value of 4th row
|
430
|
+
* @param initialM43 - defines 3rd value of 4th row
|
431
|
+
* @param initialM44 - defines 4th value of 4th row
|
432
|
+
* @param result - defines the target matrix
|
433
|
+
*/
|
434
|
+
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;
|
435
|
+
/**
|
436
|
+
* Creates new matrix from a list of values (16)
|
437
|
+
* @param initialM11 - defines 1st value of 1st row
|
438
|
+
* @param initialM12 - defines 2nd value of 1st row
|
439
|
+
* @param initialM13 - defines 3rd value of 1st row
|
440
|
+
* @param initialM14 - defines 4th value of 1st row
|
441
|
+
* @param initialM21 - defines 1st value of 2nd row
|
442
|
+
* @param initialM22 - defines 2nd value of 2nd row
|
443
|
+
* @param initialM23 - defines 3rd value of 2nd row
|
444
|
+
* @param initialM24 - defines 4th value of 2nd row
|
445
|
+
* @param initialM31 - defines 1st value of 3rd row
|
446
|
+
* @param initialM32 - defines 2nd value of 3rd row
|
447
|
+
* @param initialM33 - defines 3rd value of 3rd row
|
448
|
+
* @param initialM34 - defines 4th value of 3rd row
|
449
|
+
* @param initialM41 - defines 1st value of 4th row
|
450
|
+
* @param initialM42 - defines 2nd value of 4th row
|
451
|
+
* @param initialM43 - defines 3rd value of 4th row
|
452
|
+
* @param initialM44 - defines 4th value of 4th row
|
453
|
+
* @returns the new matrix
|
454
|
+
*/
|
455
|
+
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;
|
456
|
+
/**
|
457
|
+
* Creates a new matrix composed by merging scale (vector3), rotation (quaternion) and translation (vector3)
|
458
|
+
* @param scale - defines the scale vector3
|
459
|
+
* @param rotation - defines the rotation quaternion
|
460
|
+
* @param translation - defines the translation vector3
|
461
|
+
* @returns a new matrix
|
462
|
+
*/
|
463
|
+
function compose(scale: Vector3.ReadonlyVector3, rotation: Quaternion.ReadonlyQuaternion, translation: Vector3.ReadonlyVector3): MutableMatrix;
|
464
|
+
/**
|
465
|
+
* Sets a matrix to a value composed by merging scale (vector3), rotation (quaternion) and translation (vector3)
|
466
|
+
* @param scale - defines the scale vector3
|
467
|
+
* @param rotation - defines the rotation quaternion
|
468
|
+
* @param translation - defines the translation vector3
|
469
|
+
* @param result - defines the target matrix
|
470
|
+
*/
|
471
|
+
function composeToRef(scale: Vector3.ReadonlyVector3, rotation: Quaternion.ReadonlyQuaternion, translation: Vector3.ReadonlyVector3, result: MutableMatrix): void;
|
472
|
+
/**
|
473
|
+
* Creates a new identity matrix
|
474
|
+
* @returns a new identity matrix
|
475
|
+
*/
|
476
|
+
function Identity(): MutableMatrix;
|
477
|
+
/**
|
478
|
+
* Creates a new identity matrix and stores the result in a given matrix
|
479
|
+
* @param result - defines the target matrix
|
480
|
+
*/
|
481
|
+
function IdentityToRef(result: MutableMatrix): void;
|
482
|
+
/**
|
483
|
+
* Creates a new zero matrix
|
484
|
+
* @returns a new zero matrix
|
485
|
+
*/
|
486
|
+
function Zero(): MutableMatrix;
|
487
|
+
/**
|
488
|
+
* Creates a new rotation matrix for "angle" radians around the X axis
|
489
|
+
* @param angle - defines the angle (in radians) to use
|
490
|
+
* @returns the new matrix
|
491
|
+
*/
|
492
|
+
function RotationX(angle: number): MutableMatrix;
|
493
|
+
/**
|
494
|
+
* Creates a new rotation matrix for "angle" radians around the X axis and stores it in a given matrix
|
495
|
+
* @param angle - defines the angle (in radians) to use
|
496
|
+
* @param result - defines the target matrix
|
497
|
+
*/
|
498
|
+
function rotationXToRef(angle: number, result: MutableMatrix): void;
|
499
|
+
/**
|
500
|
+
* Creates a new rotation matrix for "angle" radians around the Y axis
|
501
|
+
* @param angle - defines the angle (in radians) to use
|
502
|
+
* @returns the new matrix
|
503
|
+
*/
|
504
|
+
function rotationY(angle: number): MutableMatrix;
|
505
|
+
/**
|
506
|
+
* Creates a new rotation matrix for "angle" radians around the Y axis and stores it in a given matrix
|
507
|
+
* @param angle - defines the angle (in radians) to use
|
508
|
+
* @param result - defines the target matrix
|
509
|
+
*/
|
510
|
+
function rotationYToRef(angle: number, result: MutableMatrix): void;
|
511
|
+
/**
|
512
|
+
* Creates a new rotation matrix for "angle" radians around the Z axis
|
513
|
+
* @param angle - defines the angle (in radians) to use
|
514
|
+
* @returns the new matrix
|
515
|
+
*/
|
516
|
+
function rotationZ(angle: number): MutableMatrix;
|
517
|
+
/**
|
518
|
+
* Creates a new rotation matrix for "angle" radians around the Z axis and stores it in a given matrix
|
519
|
+
* @param angle - defines the angle (in radians) to use
|
520
|
+
* @param result - defines the target matrix
|
521
|
+
*/
|
522
|
+
function rotationZToRef(angle: number, result: MutableMatrix): void;
|
523
|
+
/**
|
524
|
+
* Creates a new rotation matrix for "angle" radians around the given axis
|
525
|
+
* @param axis - defines the axis to use
|
526
|
+
* @param angle - defines the angle (in radians) to use
|
527
|
+
* @returns the new matrix
|
528
|
+
*/
|
529
|
+
function rotationAxis(axis: Vector3.ReadonlyVector3, angle: number): MutableMatrix;
|
530
|
+
/**
|
531
|
+
* Creates a new rotation matrix for "angle" radians around the given axis and stores it in a given matrix
|
532
|
+
* @param axis - defines the axis to use
|
533
|
+
* @param angle - defines the angle (in radians) to use
|
534
|
+
* @param result - defines the target matrix
|
535
|
+
*/
|
536
|
+
function rotationAxisToRef(_axis: Vector3.ReadonlyVector3, angle: number, result: MutableMatrix): void;
|
537
|
+
/**
|
538
|
+
* Creates a rotation matrix
|
539
|
+
* @param yaw - defines the yaw angle in radians (Y axis)
|
540
|
+
* @param pitch - defines the pitch angle in radians (X axis)
|
541
|
+
* @param roll - defines the roll angle in radians (X axis)
|
542
|
+
* @returns the new rotation matrix
|
543
|
+
*/
|
544
|
+
function rotationYawPitchRoll(yaw: number, pitch: number, roll: number): MutableMatrix;
|
545
|
+
/**
|
546
|
+
* Creates a rotation matrix and stores it in a given matrix
|
547
|
+
* @param yaw - defines the yaw angle in radians (Y axis)
|
548
|
+
* @param pitch - defines the pitch angle in radians (X axis)
|
549
|
+
* @param roll - defines the roll angle in radians (X axis)
|
550
|
+
* @param result - defines the target matrix
|
551
|
+
*/
|
552
|
+
function rotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: MutableMatrix): void;
|
553
|
+
/**
|
554
|
+
* Creates a scaling matrix
|
555
|
+
* @param x - defines the scale factor on X axis
|
556
|
+
* @param y - defines the scale factor on Y axis
|
557
|
+
* @param z - defines the scale factor on Z axis
|
558
|
+
* @returns the new matrix
|
559
|
+
*/
|
560
|
+
function scaling(x: number, y: number, z: number): MutableMatrix;
|
561
|
+
/**
|
562
|
+
* Creates a scaling matrix and stores it in a given matrix
|
563
|
+
* @param x - defines the scale factor on X axis
|
564
|
+
* @param y - defines the scale factor on Y axis
|
565
|
+
* @param z - defines the scale factor on Z axis
|
566
|
+
* @param result - defines the target matrix
|
567
|
+
*/
|
568
|
+
function scalingToRef(x: number, y: number, z: number, result: MutableMatrix): void;
|
569
|
+
/**
|
570
|
+
* Creates a translation matrix
|
571
|
+
* @param x - defines the translation on X axis
|
572
|
+
* @param y - defines the translation on Y axis
|
573
|
+
* @param z - defines the translationon Z axis
|
574
|
+
* @returns the new matrix
|
575
|
+
*/
|
576
|
+
function translation(x: number, y: number, z: number): MutableMatrix;
|
577
|
+
/**
|
578
|
+
* Creates a translation matrix and stores it in a given matrix
|
579
|
+
* @param x - defines the translation on X axis
|
580
|
+
* @param y - defines the translation on Y axis
|
581
|
+
* @param z - defines the translationon Z axis
|
582
|
+
* @param result - defines the target matrix
|
583
|
+
*/
|
584
|
+
function translationToRef(x: number, y: number, z: number, result: MutableMatrix): void;
|
585
|
+
/**
|
586
|
+
* Returns a new Matrix whose values are the interpolated values for "gradient" (float) between the ones of the matrices "startValue" and "endValue".
|
587
|
+
* @param startValue - defines the start value
|
588
|
+
* @param endValue - defines the end value
|
589
|
+
* @param gradient - defines the gradient factor
|
590
|
+
* @returns the new matrix
|
591
|
+
*/
|
592
|
+
function lerp(startValue: ReadonlyMatrix, endValue: ReadonlyMatrix, gradient: number): MutableMatrix;
|
593
|
+
/**
|
594
|
+
* Set the given matrix "result" as the interpolated values for "gradient" (float) between the ones of the matrices "startValue" and "endValue".
|
595
|
+
* @param startValue - defines the start value
|
596
|
+
* @param endValue - defines the end value
|
597
|
+
* @param gradient - defines the gradient factor
|
598
|
+
* @param result - defines the Matrix object where to store data
|
599
|
+
*/
|
600
|
+
function lerpToRef(startValue: ReadonlyMatrix, endValue: ReadonlyMatrix, gradient: number, result: MutableMatrix): void;
|
601
|
+
/**
|
602
|
+
* Builds a new matrix whose values are computed by:
|
603
|
+
* * decomposing the the "startValue" and "endValue" matrices into their respective scale, rotation and translation matrices
|
604
|
+
* * interpolating for "gradient" (float) the values between each of these decomposed matrices between the start and the end
|
605
|
+
* * recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices
|
606
|
+
* @param startValue - defines the first matrix
|
607
|
+
* @param endValue - defines the second matrix
|
608
|
+
* @param gradient - defines the gradient between the two matrices
|
609
|
+
* @returns the new matrix
|
610
|
+
*/
|
611
|
+
function decomposeLerp(startValue: ReadonlyMatrix, endValue: ReadonlyMatrix, gradient: number): MutableMatrix;
|
612
|
+
/**
|
613
|
+
* Update a matrix to values which are computed by:
|
614
|
+
* * decomposing the the "startValue" and "endValue" matrices into their respective scale, rotation and translation matrices
|
615
|
+
* * interpolating for "gradient" (float) the values between each of these decomposed matrices between the start and the end
|
616
|
+
* * recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices
|
617
|
+
* @param startValue - defines the first matrix
|
618
|
+
* @param endValue - defines the second matrix
|
619
|
+
* @param gradient - defines the gradient between the two matrices
|
620
|
+
* @param result - defines the target matrix
|
621
|
+
*/
|
622
|
+
function decomposeLerpToRef(startValue: ReadonlyMatrix, endValue: ReadonlyMatrix, gradient: number, result: MutableMatrix): void;
|
623
|
+
/**
|
624
|
+
* 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"
|
625
|
+
* self function works in left handed mode
|
626
|
+
* @param eye - defines the final position of the entity
|
627
|
+
* @param target - defines where the entity should look at
|
628
|
+
* @param up - defines the up vector for the entity
|
629
|
+
* @returns the new matrix
|
630
|
+
*/
|
631
|
+
function LookAtLH(eye: Vector3.ReadonlyVector3, target: Vector3.ReadonlyVector3, up: Vector3.ReadonlyVector3): MutableMatrix;
|
632
|
+
/**
|
633
|
+
* 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".
|
634
|
+
* self function works in left handed mode
|
635
|
+
* @param eye - defines the final position of the entity
|
636
|
+
* @param target - defines where the entity should look at
|
637
|
+
* @param up - defines the up vector for the entity
|
638
|
+
* @param result - defines the target matrix
|
639
|
+
*/
|
640
|
+
function lookAtLHToRef(eye: Vector3.ReadonlyVector3, target: Vector3.ReadonlyVector3, up: Vector3.ReadonlyVector3, result: MutableMatrix): void;
|
641
|
+
/**
|
642
|
+
* 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"
|
643
|
+
* self function works in right handed mode
|
644
|
+
* @param eye - defines the final position of the entity
|
645
|
+
* @param target - defines where the entity should look at
|
646
|
+
* @param up - defines the up vector for the entity
|
647
|
+
* @returns the new matrix
|
648
|
+
*/
|
649
|
+
function lookAtRH(eye: Vector3.ReadonlyVector3, target: Vector3.ReadonlyVector3, up: Vector3.ReadonlyVector3): MutableMatrix;
|
650
|
+
/**
|
651
|
+
* 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".
|
652
|
+
* self function works in right handed mode
|
653
|
+
* @param eye - defines the final position of the entity
|
654
|
+
* @param target - defines where the entity should look at
|
655
|
+
* @param up - defines the up vector for the entity
|
656
|
+
* @param result - defines the target matrix
|
657
|
+
*/
|
658
|
+
function lookAtRHToRef(eye: Vector3.ReadonlyVector3, target: Vector3.ReadonlyVector3, up: Vector3.ReadonlyVector3, result: MutableMatrix): void;
|
659
|
+
/**
|
660
|
+
* Create a left-handed orthographic projection matrix
|
661
|
+
* @param width - defines the viewport width
|
662
|
+
* @param height - defines the viewport height
|
663
|
+
* @param znear - defines the near clip plane
|
664
|
+
* @param zfar - defines the far clip plane
|
665
|
+
* @returns a new matrix as a left-handed orthographic projection matrix
|
666
|
+
*/
|
667
|
+
function orthoLH(width: number, height: number, znear: number, zfar: number): MutableMatrix;
|
668
|
+
/**
|
669
|
+
* Store a left-handed orthographic projection to a given matrix
|
670
|
+
* @param width - defines the viewport width
|
671
|
+
* @param height - defines the viewport height
|
672
|
+
* @param znear - defines the near clip plane
|
673
|
+
* @param zfar - defines the far clip plane
|
674
|
+
* @param result - defines the target matrix
|
675
|
+
*/
|
676
|
+
function orthoLHToRef(width: number, height: number, znear: number, zfar: number, result: MutableMatrix): void;
|
677
|
+
/**
|
678
|
+
* Create a left-handed orthographic projection matrix
|
679
|
+
* @param left - defines the viewport left coordinate
|
680
|
+
* @param right - defines the viewport right coordinate
|
681
|
+
* @param bottom - defines the viewport bottom coordinate
|
682
|
+
* @param top - defines the viewport top coordinate
|
683
|
+
* @param znear - defines the near clip plane
|
684
|
+
* @param zfar - defines the far clip plane
|
685
|
+
* @returns a new matrix as a left-handed orthographic projection matrix
|
686
|
+
*/
|
687
|
+
function OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): MutableMatrix;
|
688
|
+
/**
|
689
|
+
* Stores a left-handed orthographic projection into a given matrix
|
690
|
+
* @param left - defines the viewport left coordinate
|
691
|
+
* @param right - defines the viewport right coordinate
|
692
|
+
* @param bottom - defines the viewport bottom coordinate
|
693
|
+
* @param top - defines the viewport top coordinate
|
694
|
+
* @param znear - defines the near clip plane
|
695
|
+
* @param zfar - defines the far clip plane
|
696
|
+
* @param result - defines the target matrix
|
697
|
+
*/
|
698
|
+
function orthoOffCenterLHToRef(left: number, right: number, bottom: number, top: number, znear: number, zfar: number, result: MutableMatrix): void;
|
699
|
+
/**
|
700
|
+
* Creates a right-handed orthographic projection matrix
|
701
|
+
* @param left - defines the viewport left coordinate
|
702
|
+
* @param right - defines the viewport right coordinate
|
703
|
+
* @param bottom - defines the viewport bottom coordinate
|
704
|
+
* @param top - defines the viewport top coordinate
|
705
|
+
* @param znear - defines the near clip plane
|
706
|
+
* @param zfar - defines the far clip plane
|
707
|
+
* @returns a new matrix as a right-handed orthographic projection matrix
|
708
|
+
*/
|
709
|
+
function orthoOffCenterRH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): MutableMatrix;
|
710
|
+
/**
|
711
|
+
* Stores a right-handed orthographic projection into a given matrix
|
712
|
+
* @param left - defines the viewport left coordinate
|
713
|
+
* @param right - defines the viewport right coordinate
|
714
|
+
* @param bottom - defines the viewport bottom coordinate
|
715
|
+
* @param top - defines the viewport top coordinate
|
716
|
+
* @param znear - defines the near clip plane
|
717
|
+
* @param zfar - defines the far clip plane
|
718
|
+
* @param result - defines the target matrix
|
719
|
+
*/
|
720
|
+
function orthoOffCenterRHToRef(left: number, right: number, bottom: number, top: number, znear: number, zfar: number, result: MutableMatrix): void;
|
721
|
+
/**
|
722
|
+
* Creates a left-handed perspective projection matrix
|
723
|
+
* @param width - defines the viewport width
|
724
|
+
* @param height - defines the viewport height
|
725
|
+
* @param znear - defines the near clip plane
|
726
|
+
* @param zfar - defines the far clip plane
|
727
|
+
* @returns a new matrix as a left-handed perspective projection matrix
|
728
|
+
*/
|
729
|
+
function perspectiveLH(width: number, height: number, znear: number, zfar: number): MutableMatrix;
|
730
|
+
/**
|
731
|
+
* Creates a left-handed perspective projection matrix
|
732
|
+
* @param fov - defines the horizontal field of view
|
733
|
+
* @param aspect - defines the aspect ratio
|
734
|
+
* @param znear - defines the near clip plane
|
735
|
+
* @param zfar - defines the far clip plane
|
736
|
+
* @returns a new matrix as a left-handed perspective projection matrix
|
737
|
+
*/
|
738
|
+
function perspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): MutableMatrix;
|
739
|
+
/**
|
740
|
+
* Stores a left-handed perspective projection into a given matrix
|
741
|
+
* @param fov - defines the horizontal field of view
|
742
|
+
* @param aspect - defines the aspect ratio
|
743
|
+
* @param znear - defines the near clip plane
|
744
|
+
* @param zfar - defines the far clip plane
|
745
|
+
* @param result - defines the target matrix
|
746
|
+
* @param isVerticalFovFixed - defines it the fov is vertically fixed (default) or horizontally
|
747
|
+
*/
|
748
|
+
function perspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: MutableMatrix, isVerticalFovFixed?: boolean): void;
|
749
|
+
/**
|
750
|
+
* Creates a right-handed perspective projection matrix
|
751
|
+
* @param fov - defines the horizontal field of view
|
752
|
+
* @param aspect - defines the aspect ratio
|
753
|
+
* @param znear - defines the near clip plane
|
754
|
+
* @param zfar - defines the far clip plane
|
755
|
+
* @returns a new matrix as a right-handed perspective projection matrix
|
756
|
+
*/
|
757
|
+
function PerspectiveFovRH(fov: number, aspect: number, znear: number, zfar: number): MutableMatrix;
|
758
|
+
/**
|
759
|
+
* Stores a right-handed perspective projection into a given matrix
|
760
|
+
* @param fov - defines the horizontal field of view
|
761
|
+
* @param aspect - defines the aspect ratio
|
762
|
+
* @param znear - defines the near clip plane
|
763
|
+
* @param zfar - defines the far clip plane
|
764
|
+
* @param result - defines the target matrix
|
765
|
+
* @param isVerticalFovFixed - defines it the fov is vertically fixed (default) or horizontally
|
766
|
+
*/
|
767
|
+
function perspectiveFovRHToRef(fov: number, aspect: number, znear: number, zfar: number, result: MutableMatrix, isVerticalFovFixed?: boolean): void;
|
768
|
+
/**
|
769
|
+
* Stores a perspective projection for WebVR info a given matrix
|
770
|
+
* @param fov - defines the field of view
|
771
|
+
* @param znear - defines the near clip plane
|
772
|
+
* @param zfar - defines the far clip plane
|
773
|
+
* @param result - defines the target matrix
|
774
|
+
* @param rightHanded - defines if the matrix must be in right-handed mode (false by default)
|
775
|
+
*/
|
776
|
+
function perspectiveFovWebVRToRef(fov: {
|
777
|
+
upDegrees: number;
|
778
|
+
downDegrees: number;
|
779
|
+
leftDegrees: number;
|
780
|
+
rightDegrees: number;
|
781
|
+
}, znear: number, zfar: number, result: MutableMatrix, rightHanded?: boolean): void;
|
782
|
+
/**
|
783
|
+
* Extracts a 2x2 matrix from a given matrix and store the result in a FloatArray
|
784
|
+
* @param matrix - defines the matrix to use
|
785
|
+
* @returns a new FloatArray array with 4 elements : the 2x2 matrix extracted from the given matrix
|
786
|
+
*/
|
787
|
+
function GetAsMatrix2x2(matrix: ReadonlyMatrix): FloatArray;
|
788
|
+
/**
|
789
|
+
* Extracts a 3x3 matrix from a given matrix and store the result in a FloatArray
|
790
|
+
* @param matrix - defines the matrix to use
|
791
|
+
* @returns a new FloatArray array with 9 elements : the 3x3 matrix extracted from the given matrix
|
792
|
+
*/
|
793
|
+
function GetAsMatrix3x3(matrix: ReadonlyMatrix): FloatArray;
|
794
|
+
/**
|
795
|
+
* Compute the transpose of a given matrix
|
796
|
+
* @param matrix - defines the matrix to transpose
|
797
|
+
* @returns the new matrix
|
798
|
+
*/
|
799
|
+
function transpose(matrix: ReadonlyMatrix): MutableMatrix;
|
800
|
+
/**
|
801
|
+
* Compute the transpose of a matrix and store it in a target matrix
|
802
|
+
* @param matrix - defines the matrix to transpose
|
803
|
+
* @param result - defines the target matrix
|
804
|
+
*/
|
805
|
+
function transposeToRef(matrix: ReadonlyMatrix, result: MutableMatrix): void;
|
806
|
+
/**
|
807
|
+
* Computes a reflection matrix from a plane
|
808
|
+
* @param plane - defines the reflection plane
|
809
|
+
* @returns a new matrix
|
810
|
+
*/
|
811
|
+
function reflection(plane: Plane.ReadonlyPlane): MutableMatrix;
|
812
|
+
/**
|
813
|
+
* Computes a reflection matrix from a plane
|
814
|
+
* @param plane - defines the reflection plane
|
815
|
+
* @param result - defines the target matrix
|
816
|
+
*/
|
817
|
+
function reflectionToRef(_plane: Plane.ReadonlyPlane, result: MutableMatrix): void;
|
818
|
+
/**
|
819
|
+
* Sets the given matrix as a rotation matrix composed from the 3 left handed axes
|
820
|
+
* @param xaxis - defines the value of the 1st axis
|
821
|
+
* @param yaxis - defines the value of the 2nd axis
|
822
|
+
* @param zaxis - defines the value of the 3rd axis
|
823
|
+
* @param result - defines the target matrix
|
824
|
+
*/
|
825
|
+
function fromXYZAxesToRef(xaxis: Vector3.ReadonlyVector3, yaxis: Vector3.ReadonlyVector3, zaxis: Vector3.ReadonlyVector3, result: MutableMatrix): void;
|
826
|
+
/**
|
827
|
+
* Creates a rotation matrix from a quaternion and stores it in a target matrix
|
828
|
+
* @param quat - defines the quaternion to use
|
829
|
+
* @param result - defines the target matrix
|
830
|
+
*/
|
831
|
+
function fromQuaternionToRef(quat: Quaternion.ReadonlyQuaternion, result: MutableMatrix): void;
|
832
|
+
/**
|
833
|
+
* Check if the current matrix is identity
|
834
|
+
* @returns true is the matrix is the identity matrix
|
835
|
+
*/
|
836
|
+
function isIdentityUpdate(self: MutableMatrix): boolean;
|
837
|
+
/**
|
838
|
+
* Check if the current matrix is identity as a texture matrix (3x2 store in 4x4)
|
839
|
+
* @returns true is the matrix is the identity matrix
|
840
|
+
*/
|
841
|
+
function isIdentityAs3x2Update(self: MutableMatrix): boolean;
|
842
|
+
/**
|
843
|
+
* Gets the determinant of the matrix
|
844
|
+
* @returns the matrix determinant
|
845
|
+
*/
|
846
|
+
function determinant(self: ReadonlyMatrix): number;
|
847
|
+
/**
|
848
|
+
* Returns the matrix as a FloatArray
|
849
|
+
* @returns the matrix underlying array
|
850
|
+
*/
|
851
|
+
function toArray(self: ReadonlyMatrix): Readonly<FloatArray>;
|
852
|
+
/**
|
853
|
+
* Returns the matrix as a FloatArray
|
854
|
+
* @returns the matrix underlying array.
|
855
|
+
*/
|
856
|
+
function asArray(self: ReadonlyMatrix): Readonly<FloatArray>;
|
857
|
+
/**
|
858
|
+
* Sets all the matrix elements to zero
|
859
|
+
* @returns the current matrix
|
860
|
+
*/
|
861
|
+
function reset(self: MutableMatrix): void;
|
862
|
+
/**
|
863
|
+
* Adds the current matrix with a second one
|
864
|
+
* @param other - defines the matrix to add
|
865
|
+
* @returns a new matrix as the addition of the current matrix and the given one
|
866
|
+
*/
|
867
|
+
function add(self: ReadonlyMatrix, other: ReadonlyMatrix): MutableMatrix;
|
868
|
+
/**
|
869
|
+
* Sets the given matrix "result" to the addition of the current matrix and the given one
|
870
|
+
* @param other - defines the matrix to add
|
871
|
+
* @param result - defines the target matrix
|
872
|
+
* @returns the current matrix
|
873
|
+
*/
|
874
|
+
function addToRef(self: ReadonlyMatrix, other: ReadonlyMatrix, result: MutableMatrix): void;
|
875
|
+
/**
|
876
|
+
* Adds in place the given matrix to the current matrix
|
877
|
+
* @param other - defines the second operand
|
878
|
+
* @returns the current updated matrix
|
879
|
+
*/
|
880
|
+
function addToSelf(self: MutableMatrix, other: ReadonlyMatrix): void;
|
881
|
+
/**
|
882
|
+
* Creates a new matrix as the invert of a given matrix
|
883
|
+
* @param source - defines the source matrix
|
884
|
+
* @returns the new matrix
|
885
|
+
*/
|
886
|
+
function invert(source: ReadonlyMatrix): MutableMatrix;
|
887
|
+
/**
|
888
|
+
* Sets the given matrix to the current inverted Matrix
|
889
|
+
* @param other - defines the target matrix
|
890
|
+
* @returns the unmodified current matrix
|
891
|
+
*/
|
892
|
+
function invertToRef(source: ReadonlyMatrix, result: MutableMatrix): void;
|
893
|
+
/**
|
894
|
+
* add a value at the specified position in the current Matrix
|
895
|
+
* @param index - the index of the value within the matrix. between 0 and 15.
|
896
|
+
* @param value - the value to be added
|
897
|
+
* @returns the current updated matrix
|
898
|
+
*/
|
899
|
+
function addAtIndex(self: MutableMatrix, index: number, value: number): void;
|
900
|
+
/**
|
901
|
+
* mutiply the specified position in the current Matrix by a value
|
902
|
+
* @param index - the index of the value within the matrix. between 0 and 15.
|
903
|
+
* @param value - the value to be added
|
904
|
+
* @returns the current updated matrix
|
905
|
+
*/
|
906
|
+
function multiplyAtIndex(self: MutableMatrix, index: number, value: number): MutableMatrix;
|
907
|
+
/**
|
908
|
+
* Inserts the translation vector (using 3 floats) in the current matrix
|
909
|
+
* @param x - defines the 1st component of the translation
|
910
|
+
* @param y - defines the 2nd component of the translation
|
911
|
+
* @param z - defines the 3rd component of the translation
|
912
|
+
* @returns the current updated matrix
|
913
|
+
*/
|
914
|
+
function setTranslationFromFloats(self: MutableMatrix, x: number, y: number, z: number): void;
|
915
|
+
/**
|
916
|
+
* Inserts the translation vector in the current matrix
|
917
|
+
* @param vector3 - defines the translation to insert
|
918
|
+
* @returns the current updated matrix
|
919
|
+
*/
|
920
|
+
function setTranslation(self: MutableMatrix, vector3: Vector3.ReadonlyVector3): void;
|
921
|
+
/**
|
922
|
+
* Gets the translation value of the current matrix
|
923
|
+
* @returns a new Vector3 as the extracted translation from the matrix
|
924
|
+
*/
|
925
|
+
function getTranslation(self: MutableMatrix): Vector3.MutableVector3;
|
926
|
+
/**
|
927
|
+
* Fill a Vector3 with the extracted translation from the matrix
|
928
|
+
* @param result - defines the Vector3 where to store the translation
|
929
|
+
* @returns the current matrix
|
930
|
+
*/
|
931
|
+
function getTranslationToRef(self: MutableMatrix, result: Vector3.MutableVector3): void;
|
932
|
+
/**
|
933
|
+
* Remove rotation and scaling part from the matrix
|
934
|
+
* @returns the updated matrix
|
935
|
+
*/
|
936
|
+
function removeRotationAndScaling(self: MutableMatrix): MutableMatrix;
|
937
|
+
/**
|
938
|
+
* Multiply two matrices
|
939
|
+
* @param other - defines the second operand
|
940
|
+
* @returns a new matrix set with the multiplication result of the current Matrix and the given one
|
941
|
+
*/
|
942
|
+
function multiply(self: MutableMatrix, other: ReadonlyMatrix): MutableMatrix;
|
943
|
+
/**
|
944
|
+
* Copy the current matrix from the given one
|
945
|
+
* @param other - defines the source matrix
|
946
|
+
* @returns the current updated matrix
|
947
|
+
*/
|
948
|
+
function copy(from: ReadonlyMatrix, dest: MutableMatrix): void;
|
949
|
+
/**
|
950
|
+
* Populates the given array from the starting index with the current matrix values
|
951
|
+
* @param array - defines the target array
|
952
|
+
* @param offset - defines the offset in the target array where to start storing values
|
953
|
+
* @returns the current matrix
|
954
|
+
*/
|
955
|
+
function copyToArray(self: ReadonlyMatrix, arrayDest: FloatArray, offsetDest?: number): void;
|
956
|
+
/**
|
957
|
+
* Sets the given matrix "result" with the multiplication result of the current Matrix and the given one
|
958
|
+
* @param other - defines the second operand
|
959
|
+
* @param result - defines the matrix where to store the multiplication
|
960
|
+
* @returns the current matrix
|
961
|
+
*/
|
962
|
+
function multiplyToRef(self: ReadonlyMatrix, other: ReadonlyMatrix, result: MutableMatrix): void;
|
963
|
+
/**
|
964
|
+
* Sets the FloatArray "result" from the given index "offset" with the multiplication of the current matrix and the given one
|
965
|
+
* @param other - defines the second operand
|
966
|
+
* @param result - defines the array where to store the multiplication
|
967
|
+
* @param offset - defines the offset in the target array where to start storing values
|
968
|
+
* @returns the current matrix
|
969
|
+
*/
|
970
|
+
function multiplyToArray(self: ReadonlyMatrix, other: ReadonlyMatrix, result: FloatArray, offset: number): void;
|
971
|
+
/**
|
972
|
+
* Check equality between self matrix and a second one
|
973
|
+
* @param value - defines the second matrix to compare
|
974
|
+
* @returns true is the current matrix and the given one values are strictly equal
|
975
|
+
*/
|
976
|
+
function equals(self: ReadonlyMatrix, value: ReadonlyMatrix): boolean;
|
977
|
+
/**
|
978
|
+
* Clone the current matrix
|
979
|
+
* @returns a new matrix from the current matrix
|
980
|
+
*/
|
981
|
+
function clone(self: ReadonlyMatrix): MutableMatrix;
|
982
|
+
/**
|
983
|
+
* Gets the hash code of the current matrix
|
984
|
+
* @returns the hash code
|
985
|
+
*/
|
986
|
+
function getHashCode(self: ReadonlyMatrix): number;
|
987
|
+
/**
|
988
|
+
* Decomposes the current Matrix into a translation, rotation and scaling components
|
989
|
+
* @param scale - defines the scale vector3 given as a reference to update
|
990
|
+
* @param rotation - defines the rotation quaternion given as a reference to update
|
991
|
+
* @param translation - defines the translation vector3 given as a reference to update
|
992
|
+
* @returns true if operation was successful
|
993
|
+
*/
|
994
|
+
function decompose(self: ReadonlyMatrix, scale?: Vector3.MutableVector3, rotation?: Quaternion.MutableQuaternion, translation?: Vector3.MutableVector3): boolean;
|
995
|
+
/**
|
996
|
+
* Gets specific row of the matrix
|
997
|
+
* @param index - defines the number of the row to get
|
998
|
+
* @returns the index-th row of the current matrix as a new Vector4
|
999
|
+
*/
|
1000
|
+
/**
|
1001
|
+
* Sets the index-th row of the current matrix to the vector4 values
|
1002
|
+
* @param index - defines the number of the row to set
|
1003
|
+
* @param row - defines the target vector4
|
1004
|
+
* @returns the updated current matrix
|
1005
|
+
*/
|
1006
|
+
/**
|
1007
|
+
* Sets the index-th row of the current matrix with the given 4 x float values
|
1008
|
+
* @param index - defines the row index
|
1009
|
+
* @param x - defines the x component to set
|
1010
|
+
* @param y - defines the y component to set
|
1011
|
+
* @param z - defines the z component to set
|
1012
|
+
* @param w - defines the w component to set
|
1013
|
+
* @returns the updated current matrix
|
1014
|
+
*/
|
1015
|
+
function setRowFromFloats(self: MutableMatrix, index: number, x: number, y: number, z: number, w: number): void;
|
1016
|
+
/**
|
1017
|
+
* Compute a new matrix set with the current matrix values multiplied by scale (float)
|
1018
|
+
* @param scale - defines the scale factor
|
1019
|
+
* @returns a new matrix
|
1020
|
+
*/
|
1021
|
+
function scale(self: ReadonlyMatrix, scale: number): MutableMatrix;
|
1022
|
+
/**
|
1023
|
+
* Scale the current matrix values by a factor to a given result matrix
|
1024
|
+
* @param scale - defines the scale factor
|
1025
|
+
* @param result - defines the matrix to store the result
|
1026
|
+
* @returns the current matrix
|
1027
|
+
*/
|
1028
|
+
function scaleToRef(self: ReadonlyMatrix, scale: number, result: MutableMatrix): void;
|
1029
|
+
/**
|
1030
|
+
* Scale the current matrix values by a factor and add the result to a given matrix
|
1031
|
+
* @param scale - defines the scale factor
|
1032
|
+
* @param result - defines the Matrix to store the result
|
1033
|
+
* @returns the current matrix
|
1034
|
+
*/
|
1035
|
+
function scaleAndAddToRef(self: ReadonlyMatrix, scale: number, result: MutableMatrix): void;
|
1036
|
+
/**
|
1037
|
+
* Writes to the given matrix a normal matrix, computed from self one (using values from identity matrix for fourth row and column).
|
1038
|
+
* @param ref - matrix to store the result
|
1039
|
+
*/
|
1040
|
+
function normalMatrixToRef(self: ReadonlyMatrix, ref: MutableMatrix): void;
|
1041
|
+
/**
|
1042
|
+
* Gets only rotation part of the current matrix
|
1043
|
+
* @returns a new matrix sets to the extracted rotation matrix from the current one
|
1044
|
+
*/
|
1045
|
+
function getRotationMatrix(self: ReadonlyMatrix): MutableMatrix;
|
1046
|
+
/**
|
1047
|
+
* Extracts the rotation matrix from the current one and sets it as the given "result"
|
1048
|
+
* @param result - defines the target matrix to store data to
|
1049
|
+
* @returns the current matrix
|
1050
|
+
*/
|
1051
|
+
function getRotationMatrixToRef(self: ReadonlyMatrix, result: MutableMatrix): void;
|
1052
|
+
/**
|
1053
|
+
* Toggles model matrix from being right handed to left handed in place and vice versa
|
1054
|
+
*/
|
1055
|
+
function toggleModelMatrixHandInPlace(self: MutableMatrix): void;
|
1056
|
+
/**
|
1057
|
+
* Toggles projection matrix from being right handed to left handed in place and vice versa
|
1058
|
+
*/
|
1059
|
+
function toggleProjectionMatrixHandInPlace(self: MutableMatrix): void;
|
1060
|
+
}
|
1061
|
+
|
1062
|
+
/** @public */
|
1063
|
+
export declare type Nullable<T> = T | null;
|
1064
|
+
|
1065
|
+
declare type OnlyNonUndefinedTypes<T> = {
|
1066
|
+
[K in ExcludeUndefined<T>]: T[K];
|
1067
|
+
};
|
1068
|
+
|
1069
|
+
declare type OnlyOptionalUndefinedTypes<T> = {
|
1070
|
+
[K in IncludeUndefined<T>]?: T[K];
|
1071
|
+
};
|
1072
|
+
|
1073
|
+
/**
|
1074
|
+
* @public
|
1075
|
+
*/
|
1076
|
+
export declare function Optional<T>(spec: EcsType<T>): EcsType<T | undefined>;
|
1077
|
+
|
1078
|
+
/**
|
1079
|
+
* Defines potential orientation for back face culling
|
1080
|
+
* @public
|
1081
|
+
*/
|
1082
|
+
export declare enum Orientation {
|
1083
|
+
/**
|
1084
|
+
* Clockwise
|
1085
|
+
*/
|
1086
|
+
CW = 0,
|
1087
|
+
/** Counter clockwise */
|
1088
|
+
CCW = 1
|
1089
|
+
}
|
1090
|
+
|
1091
|
+
declare interface PBAudioSource {
|
1092
|
+
playing: boolean;
|
1093
|
+
volume: number;
|
1094
|
+
loop: boolean;
|
1095
|
+
pitch: number;
|
1096
|
+
playedAtTimestamp: number;
|
1097
|
+
audioClipUrl: string;
|
1098
|
+
}
|
1099
|
+
|
1100
|
+
declare interface PBAudioStream {
|
1101
|
+
playing: boolean;
|
1102
|
+
volume: number;
|
1103
|
+
url: string;
|
1104
|
+
}
|
1105
|
+
|
1106
|
+
declare interface PBBoxShape {
|
1107
|
+
withCollisions: boolean;
|
1108
|
+
isPointerBlocker: boolean;
|
1109
|
+
visible: boolean;
|
1110
|
+
uvs: number[];
|
1111
|
+
}
|
1112
|
+
|
1113
|
+
declare interface PBCylinderShape {
|
1114
|
+
withCollisions: boolean;
|
1115
|
+
isPointerBlocker: boolean;
|
1116
|
+
visible: boolean;
|
1117
|
+
radiusTop: number;
|
1118
|
+
radiusBottom: number;
|
1119
|
+
}
|
1120
|
+
|
1121
|
+
declare interface PBNFTShape {
|
1122
|
+
withCollisions: boolean;
|
1123
|
+
isPointerBlocker: boolean;
|
1124
|
+
visible: boolean;
|
1125
|
+
src: string;
|
1126
|
+
assetId: string;
|
1127
|
+
style: number;
|
1128
|
+
color: Color3 | undefined;
|
1129
|
+
}
|
1130
|
+
|
1131
|
+
declare interface PBPlaneShape {
|
1132
|
+
withCollisions: boolean;
|
1133
|
+
isPointerBlocker: boolean;
|
1134
|
+
visible: boolean;
|
1135
|
+
uvs: number[];
|
1136
|
+
}
|
1137
|
+
|
1138
|
+
declare interface PBSphereShape {
|
1139
|
+
withCollisions: boolean;
|
1140
|
+
isPointerBlocker: boolean;
|
1141
|
+
visible: boolean;
|
1142
|
+
}
|
1143
|
+
|
1144
|
+
declare interface PBTextShape {
|
1145
|
+
text: string;
|
1146
|
+
visible: boolean;
|
1147
|
+
font: string;
|
1148
|
+
opacity: number;
|
1149
|
+
fontSize: number;
|
1150
|
+
fontAutoSize: boolean;
|
1151
|
+
hTextAlign: string;
|
1152
|
+
vTextAlign: string;
|
1153
|
+
width: number;
|
1154
|
+
height: number;
|
1155
|
+
paddingTop: number;
|
1156
|
+
paddingRight: number;
|
1157
|
+
paddingBottom: number;
|
1158
|
+
paddingLeft: number;
|
1159
|
+
lineSpacing: number;
|
1160
|
+
lineCount: number;
|
1161
|
+
textWrapping: boolean;
|
1162
|
+
shadowBlur: number;
|
1163
|
+
shadowOffsetX: number;
|
1164
|
+
shadowOffsetY: number;
|
1165
|
+
outlineWidth: number;
|
1166
|
+
shadowColor: Color3 | undefined;
|
1167
|
+
outlineColor: Color3 | undefined;
|
1168
|
+
textColor: Color3 | undefined;
|
1169
|
+
}
|
1170
|
+
|
1171
|
+
/**
|
1172
|
+
* Represens a plane by the equation ax + by + cz + d = 0
|
1173
|
+
* @public
|
1174
|
+
*/
|
1175
|
+
declare namespace Plane {
|
1176
|
+
type MutablePlane = {
|
1177
|
+
/**
|
1178
|
+
* Normal of the plane (a,b,c)
|
1179
|
+
*/
|
1180
|
+
normal: Vector3.MutableVector3;
|
1181
|
+
/**
|
1182
|
+
* d component of the plane
|
1183
|
+
*/
|
1184
|
+
d: number;
|
1185
|
+
};
|
1186
|
+
type ReadonlyPlane = DeepReadonly<MutablePlane>;
|
1187
|
+
/**
|
1188
|
+
* Creates a Plane object according to the given floats a, b, c, d and the plane equation : ax + by + cz + d = 0
|
1189
|
+
* @param a - a component of the plane
|
1190
|
+
* @param b - b component of the plane
|
1191
|
+
* @param c - c component of the plane
|
1192
|
+
* @param d - d component of the plane
|
1193
|
+
*/
|
1194
|
+
function create(a: number, b: number, c: number, d: number): {
|
1195
|
+
normal: Vector3.MutableVector3;
|
1196
|
+
d: number;
|
1197
|
+
};
|
1198
|
+
/**
|
1199
|
+
* Creates a plane from an array
|
1200
|
+
* @param array - the array to create a plane from
|
1201
|
+
* @returns a new Plane from the given array.
|
1202
|
+
*/
|
1203
|
+
function fromArray(array: ArrayLike<number>): MutablePlane;
|
1204
|
+
/**
|
1205
|
+
* Creates a plane from three points
|
1206
|
+
* @param point1 - point used to create the plane
|
1207
|
+
* @param point2 - point used to create the plane
|
1208
|
+
* @param point3 - point used to create the plane
|
1209
|
+
* @returns a new Plane defined by the three given points.
|
1210
|
+
*/
|
1211
|
+
function fromPoints(_point1: Vector3.ReadonlyVector3, _point2: Vector3.ReadonlyVector3, _point3: Vector3.ReadonlyVector3): MutablePlane;
|
1212
|
+
/**
|
1213
|
+
* Creates a plane from an origin point and a normal
|
1214
|
+
* @param origin - origin of the plane to be constructed
|
1215
|
+
* @param normal - normal of the plane to be constructed
|
1216
|
+
* @returns a new Plane the normal vector to this plane at the given origin point.
|
1217
|
+
* Note : the vector "normal" is updated because normalized.
|
1218
|
+
*/
|
1219
|
+
function romPositionAndNormal(origin: Vector3.ReadonlyVector3, normal: Vector3.ReadonlyVector3): MutablePlane;
|
1220
|
+
/**
|
1221
|
+
* Calculates the distance from a plane and a point
|
1222
|
+
* @param origin - origin of the plane to be constructed
|
1223
|
+
* @param normal - normal of the plane to be constructed
|
1224
|
+
* @param point - point to calculate distance to
|
1225
|
+
* @returns the signed distance between the plane defined by the normal vector at the "origin"" point and the given other point.
|
1226
|
+
*/
|
1227
|
+
function signedDistanceToPlaneFromPositionAndNormal(origin: Vector3.ReadonlyVector3, normal: Vector3.ReadonlyVector3, point: Vector3.ReadonlyVector3): number;
|
1228
|
+
/**
|
1229
|
+
* @returns the plane coordinates as a new array of 4 elements [a, b, c, d].
|
1230
|
+
*/
|
1231
|
+
function asArray(plane: ReadonlyPlane): number[];
|
1232
|
+
/**
|
1233
|
+
* @returns a new plane copied from the current Plane.
|
1234
|
+
*/
|
1235
|
+
function clone(plane: ReadonlyPlane): MutablePlane;
|
1236
|
+
/**
|
1237
|
+
* @returns the Plane hash code.
|
1238
|
+
*/
|
1239
|
+
function getHashCode(_plane: ReadonlyPlane): number;
|
1240
|
+
/**
|
1241
|
+
* Normalize the current Plane in place.
|
1242
|
+
* @returns the updated Plane.
|
1243
|
+
*/
|
1244
|
+
function normalize(plane: ReadonlyPlane): MutablePlane;
|
1245
|
+
/**
|
1246
|
+
* Applies a transformation the plane and returns the result
|
1247
|
+
* @param transformation - the transformation matrix to be applied to the plane
|
1248
|
+
* @returns a new Plane as the result of the transformation of the current Plane by the given matrix.
|
1249
|
+
*/
|
1250
|
+
function transform(plane: ReadonlyPlane, transformation: Matrix.ReadonlyMatrix): MutablePlane;
|
1251
|
+
/**
|
1252
|
+
* Calcualtte the dot product between the point and the plane normal
|
1253
|
+
* @param point - point to calculate the dot product with
|
1254
|
+
* @returns the dot product (float) of the point coordinates and the plane normal.
|
1255
|
+
*/
|
1256
|
+
function dotCoordinate(plane: ReadonlyPlane, point: Vector3.ReadonlyVector3): number;
|
1257
|
+
/**
|
1258
|
+
* Updates the current Plane from the plane defined by the three given points.
|
1259
|
+
* @param point1 - one of the points used to contruct the plane
|
1260
|
+
* @param point2 - one of the points used to contruct the plane
|
1261
|
+
* @param point3 - one of the points used to contruct the plane
|
1262
|
+
* @returns the updated Plane.
|
1263
|
+
*/
|
1264
|
+
function copyFromPoints(point1: Vector3.ReadonlyVector3, point2: Vector3.ReadonlyVector3, point3: Vector3.ReadonlyVector3): MutablePlane;
|
1265
|
+
/**
|
1266
|
+
* Checks if the plane is facing a given direction
|
1267
|
+
* @param direction - the direction to check if the plane is facing
|
1268
|
+
* @param epsilon - value the dot product is compared against (returns true if dot <= epsilon)
|
1269
|
+
* @returns True is the vector "direction" is the same side than the plane normal.
|
1270
|
+
*/
|
1271
|
+
function isFrontFacingTo(plane: ReadonlyPlane, direction: Vector3.ReadonlyVector3, epsilon: number): boolean;
|
1272
|
+
/**
|
1273
|
+
* Calculates the distance to a point
|
1274
|
+
* @param point - point to calculate distance to
|
1275
|
+
* @returns the signed distance (float) from the given point to the Plane.
|
1276
|
+
*/
|
1277
|
+
function signedDistanceTo(plane: ReadonlyPlane, point: Vector3.ReadonlyVector3): number;
|
1278
|
+
}
|
1279
|
+
|
1280
|
+
/**
|
1281
|
+
* @public
|
1282
|
+
*/
|
1283
|
+
export declare namespace Quaternion {
|
1284
|
+
/**
|
1285
|
+
* @public
|
1286
|
+
*/
|
1287
|
+
export type MutableQuaternion = {
|
1288
|
+
y: number;
|
1289
|
+
x: number;
|
1290
|
+
z: number;
|
1291
|
+
w: number;
|
1292
|
+
};
|
1293
|
+
/**
|
1294
|
+
* @public
|
1295
|
+
*/
|
1296
|
+
export type ReadonlyQuaternion = DeepReadonly<MutableQuaternion>;
|
1297
|
+
/**
|
1298
|
+
* Creates a new Quaternion from the given floats
|
1299
|
+
* @param x - defines the first component (0 by default)
|
1300
|
+
* @param y - defines the second component (0 by default)
|
1301
|
+
* @param z - defines the third component (0 by default)
|
1302
|
+
* @param w - defines the fourth component (1.0 by default)
|
1303
|
+
*/
|
1304
|
+
export function create(
|
1305
|
+
/** defines the first component (0 by default) */
|
1306
|
+
x?: number,
|
1307
|
+
/** defines the second component (0 by default) */
|
1308
|
+
y?: number,
|
1309
|
+
/** defines the third component (0 by default) */
|
1310
|
+
z?: number,
|
1311
|
+
/** defines the fourth component (1.0 by default) */
|
1312
|
+
w?: number): MutableQuaternion;
|
1313
|
+
/**
|
1314
|
+
* Returns a new Quaternion as the result of the addition of the two given quaternions.
|
1315
|
+
* @param q1 - the first quaternion
|
1316
|
+
* @param q2 - the second quaternion
|
1317
|
+
* @returns the resulting quaternion
|
1318
|
+
*/
|
1319
|
+
export function add(q1: ReadonlyQuaternion, q2: ReadonlyQuaternion): MutableQuaternion;
|
1320
|
+
/**
|
1321
|
+
* Creates a new rotation from the given Euler float angles (y, x, z) and stores it in the target quaternion
|
1322
|
+
* @param yaw - defines the rotation around Y axis
|
1323
|
+
* @param pitch - defines the rotation around X axis
|
1324
|
+
* @param roll - defines the rotation around Z axis
|
1325
|
+
* @param result - defines the target quaternion
|
1326
|
+
*/
|
1327
|
+
export function rotationYawPitchRoll(yaw: number, pitch: number, roll: number): MutableQuaternion;
|
1328
|
+
/**
|
1329
|
+
* Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis.
|
1330
|
+
* @param x - the rotation on the x axis in euler degrees
|
1331
|
+
* @param y - the rotation on the y axis in euler degrees
|
1332
|
+
* @param z - the rotation on the z axis in euler degrees
|
1333
|
+
*/
|
1334
|
+
export function euler(x: number, y: number, z: number): MutableQuaternion;
|
1335
|
+
/**
|
1336
|
+
* Gets length of current quaternion
|
1337
|
+
* @returns the quaternion length (float)
|
1338
|
+
*/
|
1339
|
+
export function length(q: ReadonlyQuaternion): number;
|
1340
|
+
/**
|
1341
|
+
* Gets length of current quaternion
|
1342
|
+
* @returns the quaternion length (float)
|
1343
|
+
*/
|
1344
|
+
export function lengthSquared(q: ReadonlyQuaternion): number;
|
1345
|
+
/**
|
1346
|
+
* Returns the dot product (float) between the quaternions "left" and "right"
|
1347
|
+
* @param left - defines the left operand
|
1348
|
+
* @param right - defines the right operand
|
1349
|
+
* @returns the dot product
|
1350
|
+
*/
|
1351
|
+
export function dot(left: ReadonlyQuaternion, right: ReadonlyQuaternion): number;
|
1352
|
+
/**
|
1353
|
+
* Returns the angle in degrees between two rotations a and b.
|
1354
|
+
* @param quat1 - defines the first quaternion
|
1355
|
+
* @param quat2 - defines the second quaternion
|
1356
|
+
*/
|
1357
|
+
export function angle(quat1: ReadonlyQuaternion, quat2: ReadonlyQuaternion): number;
|
1358
|
+
/**
|
1359
|
+
* The from quaternion is rotated towards to by an angular step of maxDegreesDelta.
|
1360
|
+
* @param from - defines the first quaternion
|
1361
|
+
* @param to - defines the second quaternion
|
1362
|
+
* @param maxDegreesDelta - the interval step
|
1363
|
+
*/
|
1364
|
+
export function rotateTowards(from: ReadonlyQuaternion, to: ReadonlyQuaternion, maxDegreesDelta: number): MutableQuaternion;
|
1365
|
+
/**
|
1366
|
+
* Creates a rotation with the specified forward and upwards directions.
|
1367
|
+
* @param forward - the direction to look in
|
1368
|
+
* @param up - the vector that defines in which direction up is
|
1369
|
+
*/
|
1370
|
+
export function lookRotation(forward: Vector3.ReadonlyVector3, up?: Vector3.ReadonlyVector3): MutableQuaternion;
|
1371
|
+
/**
|
1372
|
+
* Normalize in place the current quaternion
|
1373
|
+
* @returns the current updated quaternion
|
1374
|
+
*/
|
1375
|
+
export function normalize(q: ReadonlyQuaternion): MutableQuaternion;
|
1376
|
+
/**
|
1377
|
+
* Creates a rotation which rotates from fromDirection to toDirection.
|
1378
|
+
* @param from - defines the first direction Vector
|
1379
|
+
* @param to - defines the target direction Vector
|
1380
|
+
*/
|
1381
|
+
export function fromToRotation(from: Vector3.ReadonlyVector3, to: Vector3.ReadonlyVector3, up?: Vector3.ReadonlyVector3): MutableQuaternion;
|
1382
|
+
/**
|
1383
|
+
* Creates an identity quaternion
|
1384
|
+
* @returns - the identity quaternion
|
1385
|
+
*/
|
1386
|
+
export function Identity(): MutableQuaternion;
|
1387
|
+
/**
|
1388
|
+
* Gets or sets the euler angle representation of the rotation.
|
1389
|
+
* Implemented unity-based calculations from: https://stackoverflow.com/a/56055813
|
1390
|
+
*/
|
1391
|
+
export function eulerAngles(q: MutableQuaternion): Vector3.MutableVector3;
|
1392
|
+
/**
|
1393
|
+
* Creates a new rotation from the given Euler float angles (y, x, z) and stores it in the target quaternion
|
1394
|
+
* @param yaw - defines the rotation around Y axis
|
1395
|
+
* @param pitch - defines the rotation around X axis
|
1396
|
+
* @param roll - defines the rotation around Z axis
|
1397
|
+
* @param result - defines the target quaternion
|
1398
|
+
*/
|
1399
|
+
export function rotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion.MutableQuaternion): void;
|
1400
|
+
/**
|
1401
|
+
* Updates the given quaternion with the given rotation matrix values
|
1402
|
+
* @param matrix - defines the source matrix
|
1403
|
+
* @param result - defines the target quaternion
|
1404
|
+
*/
|
1405
|
+
export function fromRotationMatrixToRef(matrix: Matrix.ReadonlyMatrix, result: Quaternion.MutableQuaternion): void;
|
1406
|
+
/**
|
1407
|
+
* Interpolates between two quaternions
|
1408
|
+
* @param left - defines first quaternion
|
1409
|
+
* @param right - defines second quaternion
|
1410
|
+
* @param amount - defines the gradient to use
|
1411
|
+
* @returns the new interpolated quaternion
|
1412
|
+
*/
|
1413
|
+
export function slerp(left: ReadonlyQuaternion, right: ReadonlyQuaternion, amount: number): MutableQuaternion;
|
1414
|
+
/**
|
1415
|
+
* Interpolates between two quaternions and stores it into a target quaternion
|
1416
|
+
* @param left - defines first quaternion
|
1417
|
+
* @param right - defines second quaternion
|
1418
|
+
* @param amount - defines the gradient to use
|
1419
|
+
* @param result - defines the target quaternion
|
1420
|
+
*/
|
1421
|
+
export function slerpToRef(left: ReadonlyQuaternion, right: ReadonlyQuaternion, amount: number, result: MutableQuaternion): void;
|
1422
|
+
/**
|
1423
|
+
* Multiplies two quaternions
|
1424
|
+
* @param self - defines the first operand
|
1425
|
+
* @param q1 - defines the second operand
|
1426
|
+
* @returns a new quaternion set as the multiplication result of the self one with the given one "q1"
|
1427
|
+
*/
|
1428
|
+
export function multiply(self: ReadonlyQuaternion, q1: ReadonlyQuaternion): MutableQuaternion;
|
1429
|
+
/**
|
1430
|
+
* Sets the given "result" as the the multiplication result of the self one with the given one "q1"
|
1431
|
+
* @param self - defines the first operand
|
1432
|
+
* @param q1 - defines the second operand
|
1433
|
+
* @param result - defines the target quaternion
|
1434
|
+
* @returns the current quaternion
|
1435
|
+
*/
|
1436
|
+
export function multiplyToRef(self: ReadonlyQuaternion, q1: ReadonlyQuaternion, result: MutableQuaternion): void;
|
1437
|
+
export function angleAxis(degress: number, axis: Vector3.ReadonlyVector3): MutableQuaternion;
|
1438
|
+
/**
|
1439
|
+
* Returns a zero filled quaternion
|
1440
|
+
*/
|
1441
|
+
export function Zero(): MutableQuaternion;
|
1442
|
+
}
|
1443
|
+
|
1444
|
+
/**
|
1445
|
+
* Constant used to convert from radians to Euler degrees
|
1446
|
+
* @public
|
1447
|
+
*/
|
1448
|
+
export declare const RAD2DEG: number;
|
1449
|
+
|
1450
|
+
/**
|
1451
|
+
* @public
|
1452
|
+
*/
|
1453
|
+
export declare type Result<T extends Spec> = ToOptional<{
|
1454
|
+
[K in keyof T]: T[K] extends EcsType ? ReturnType<T[K]['deserialize']> : T[K] extends Spec ? Result<T[K]> : never;
|
1455
|
+
}>;
|
1456
|
+
|
1457
|
+
/**
|
1458
|
+
* @public
|
1459
|
+
*/
|
1460
|
+
export declare type SdkComponetns = ReturnType<typeof defineSdkComponents>;
|
1461
|
+
|
1462
|
+
/**
|
1463
|
+
* Defines supported spaces
|
1464
|
+
* @public
|
1465
|
+
*/
|
1466
|
+
export declare enum Space {
|
1467
|
+
/** Local (object) space */
|
1468
|
+
LOCAL = 0,
|
1469
|
+
/** World space */
|
1470
|
+
WORLD = 1,
|
1471
|
+
/** Bone space */
|
1472
|
+
BONE = 2
|
1473
|
+
}
|
1474
|
+
|
1475
|
+
/**
|
1476
|
+
* @public
|
1477
|
+
*/
|
1478
|
+
export declare interface Spec {
|
1479
|
+
[key: string]: EcsType;
|
1480
|
+
}
|
1481
|
+
|
1482
|
+
/**
|
1483
|
+
* Constant used to convert a value to gamma space
|
1484
|
+
* @public
|
1485
|
+
*/
|
1486
|
+
export declare const ToGammaSpace: number;
|
1487
|
+
|
1488
|
+
/**
|
1489
|
+
* Constant used to convert a value to linear space
|
1490
|
+
* @public
|
1491
|
+
*/
|
1492
|
+
export declare const ToLinearSpace = 2.2;
|
1493
|
+
|
1494
|
+
declare type ToOptional<T> = OnlyOptionalUndefinedTypes<T> & OnlyNonUndefinedTypes<T>;
|
1495
|
+
|
1496
|
+
/**
|
1497
|
+
* @public
|
1498
|
+
*/
|
1499
|
+
declare type Transform = {
|
1500
|
+
position: Vector3.MutableVector3;
|
1501
|
+
rotation: Quaternion.MutableQuaternion;
|
1502
|
+
scale: Vector3.MutableVector3;
|
1503
|
+
parent?: Entity;
|
1504
|
+
};
|
1505
|
+
|
1506
|
+
declare const Transform: EcsType<Transform>;
|
1507
|
+
|
1508
|
+
/**
|
1509
|
+
* @public
|
1510
|
+
*/
|
1511
|
+
export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
|
1512
|
+
|
1513
|
+
/**
|
1514
|
+
* @public
|
1515
|
+
*/
|
1516
|
+
export declare type Update = (dt: number) => void;
|
1517
|
+
|
1518
|
+
/**
|
1519
|
+
* @public
|
1520
|
+
*/
|
1521
|
+
export declare namespace Vector3 {
|
1522
|
+
/**
|
1523
|
+
* @public
|
1524
|
+
*/
|
1525
|
+
export type MutableVector3 = {
|
1526
|
+
y: number;
|
1527
|
+
x: number;
|
1528
|
+
z: number;
|
1529
|
+
};
|
1530
|
+
/**
|
1531
|
+
* @public
|
1532
|
+
*/
|
1533
|
+
export type ReadonlyVector3 = DeepReadonly<MutableVector3>;
|
1534
|
+
/**
|
1535
|
+
* Creates a new Vector3 object from the given x, y, z (floats) coordinates.
|
1536
|
+
* @param x - defines the first coordinates (on X axis)
|
1537
|
+
* @param y - defines the second coordinates (on Y axis)
|
1538
|
+
* @param z - defines the third coordinates (on Z axis)
|
1539
|
+
*/
|
1540
|
+
export function create(
|
1541
|
+
/**
|
1542
|
+
* Defines the first coordinates (on X axis)
|
1543
|
+
*/
|
1544
|
+
x?: number,
|
1545
|
+
/**
|
1546
|
+
* Defines the second coordinates (on Y axis)
|
1547
|
+
*/
|
1548
|
+
y?: number,
|
1549
|
+
/**
|
1550
|
+
* Defines the third coordinates (on Z axis)
|
1551
|
+
*/
|
1552
|
+
z?: number): MutableVector3;
|
1553
|
+
/**
|
1554
|
+
* Returns a new Vector3 as the result of the addition of the two given vectors.
|
1555
|
+
* @param vector1 - the first vector
|
1556
|
+
* @param vector2 - the second vector
|
1557
|
+
* @returns the resulting vector
|
1558
|
+
*/
|
1559
|
+
export function add(vector1: ReadonlyVector3, vector2: ReadonlyVector3): MutableVector3;
|
1560
|
+
/**
|
1561
|
+
* Returns a new Vector3 as the result of the substraction of the two given vectors.
|
1562
|
+
* @returns the resulting vector
|
1563
|
+
*/
|
1564
|
+
export function subtract(minuend: ReadonlyVector3, subtrahend: ReadonlyVector3): MutableVector3;
|
1565
|
+
/**
|
1566
|
+
* Returns a new Vector3 as the result of the substraction of the two given vectors.
|
1567
|
+
* @returns the resulting vector
|
1568
|
+
*/
|
1569
|
+
export function subtractToRef(minuend: ReadonlyVector3, subtrahend: ReadonlyVector3, result: MutableVector3): void;
|
1570
|
+
/**
|
1571
|
+
* Returns a new Vector3 with the other sign
|
1572
|
+
* @returns the resulting vector
|
1573
|
+
*/
|
1574
|
+
export function opposite(value: ReadonlyVector3): MutableVector3;
|
1575
|
+
/**
|
1576
|
+
* Copy source into dest
|
1577
|
+
*
|
1578
|
+
*/
|
1579
|
+
export function copy(source: ReadonlyVector3, dest: MutableVector3): void;
|
1580
|
+
/**
|
1581
|
+
* Returns a new Vector3 with the same value
|
1582
|
+
* @returns the resulting vector
|
1583
|
+
*/
|
1584
|
+
export function clone(source: ReadonlyVector3): MutableVector3;
|
1585
|
+
/**
|
1586
|
+
* Gets the length of the Vector3
|
1587
|
+
* @returns the length of the Vecto3
|
1588
|
+
*/
|
1589
|
+
export function length(vector: ReadonlyVector3): number;
|
1590
|
+
/**
|
1591
|
+
* Gets the squared length of the Vector3
|
1592
|
+
* @returns squared length of the Vector3
|
1593
|
+
*/
|
1594
|
+
export function lengthSquared(vector: ReadonlyVector3): number;
|
1595
|
+
/**
|
1596
|
+
* Returns a new Vector3 set with the current Vector3 coordinates multiplied by the float "scale"
|
1597
|
+
* @param scale - defines the multiplier factor
|
1598
|
+
* @returns a new Vector3
|
1599
|
+
*/
|
1600
|
+
export function scaleToRef(vector: ReadonlyVector3, scale: number, result: MutableVector3): void;
|
1601
|
+
/**
|
1602
|
+
* Returns a new Vector3 set with the current Vector3 coordinates multiplied by the float "scale"
|
1603
|
+
* @param scale - defines the multiplier factor
|
1604
|
+
* @returns a new Vector3
|
1605
|
+
*/
|
1606
|
+
export function scale(vector: ReadonlyVector3, scale: number): MutableVector3;
|
1607
|
+
/**
|
1608
|
+
* Normalize the current Vector3 with the given input length.
|
1609
|
+
* Please note that this is an in place operation.
|
1610
|
+
* @param len - the length of the vector
|
1611
|
+
* @returns the current updated Vector3
|
1612
|
+
*/
|
1613
|
+
export function normalizeFromLength(vector: ReadonlyVector3, len: number): MutableVector3;
|
1614
|
+
/**
|
1615
|
+
* Normalize the current Vector3 with the given input length.
|
1616
|
+
* Please note that this is an in place operation.
|
1617
|
+
* @param len - the length of the vector
|
1618
|
+
* @returns the current updated Vector3
|
1619
|
+
*/
|
1620
|
+
export function normalizeFromLengthToRef(vector: ReadonlyVector3, len: number, result: MutableVector3): void;
|
1621
|
+
/**
|
1622
|
+
* Normalize the current Vector3.
|
1623
|
+
* Please note that this is an in place operation.
|
1624
|
+
* @returns the current updated Vector3
|
1625
|
+
*/
|
1626
|
+
export function normalize(vector: ReadonlyVector3): MutableVector3;
|
1627
|
+
/**
|
1628
|
+
* Normalize the current Vector3.
|
1629
|
+
* Please note that this is an in place operation.
|
1630
|
+
* @returns the current updated Vector3
|
1631
|
+
*/
|
1632
|
+
export function normalizeToRef(vector: ReadonlyVector3, result: MutableVector3): void;
|
1633
|
+
/**
|
1634
|
+
* Returns the dot product (float) between the vectors "left" and "right"
|
1635
|
+
* @param left - defines the left operand
|
1636
|
+
* @param right - defines the right operand
|
1637
|
+
* @returns the dot product
|
1638
|
+
*/
|
1639
|
+
export function dot(left: ReadonlyVector3, right: ReadonlyVector3): number;
|
1640
|
+
/**
|
1641
|
+
* Rotates current Vector3 based on the given quaternion, but applies the rotation to target Vector3.
|
1642
|
+
* @param q - defines the Quaternion
|
1643
|
+
* @param result - defines the target Vector3
|
1644
|
+
* @returns the current Vector3
|
1645
|
+
*/
|
1646
|
+
export function rotate(vector: ReadonlyVector3, q: Quaternion.ReadonlyQuaternion): MutableVector3;
|
1647
|
+
/**
|
1648
|
+
* Returns a new Vector3 located for "amount" (float) on the linear interpolation between the vectors "start" and "end"
|
1649
|
+
* @param start - defines the start value
|
1650
|
+
* @param end - defines the end value
|
1651
|
+
* @param amount - max defines amount between both (between 0 and 1)
|
1652
|
+
* @returns the new Vector3
|
1653
|
+
*/
|
1654
|
+
export function lerp(start: ReadonlyVector3, end: ReadonlyVector3, amount: number): MutableVector3;
|
1655
|
+
/**
|
1656
|
+
* Sets the given vector "result" with the result of the linear interpolation from the vector "start" for "amount" to the vector "end"
|
1657
|
+
* @param start - defines the start value
|
1658
|
+
* @param end - defines the end value
|
1659
|
+
* @param amount - max defines amount between both (between 0 and 1)
|
1660
|
+
* @param result - defines the Vector3 where to store the result
|
1661
|
+
*/
|
1662
|
+
export function lerpToRef(start: ReadonlyVector3, end: ReadonlyVector3, amount: number, result: MutableVector3): void;
|
1663
|
+
/**
|
1664
|
+
* Returns a new Vector3 as the cross product of the vectors "left" and "right"
|
1665
|
+
* The cross product is then orthogonal to both "left" and "right"
|
1666
|
+
* @param left - defines the left operand
|
1667
|
+
* @param right - defines the right operand
|
1668
|
+
* @returns the cross product
|
1669
|
+
*/
|
1670
|
+
export function cross(left: ReadonlyVector3, right: ReadonlyVector3): MutableVector3;
|
1671
|
+
/**
|
1672
|
+
* Sets the given vector "result" with the cross product of "left" and "right"
|
1673
|
+
* The cross product is then orthogonal to both "left" and "right"
|
1674
|
+
* @param left - defines the left operand
|
1675
|
+
* @param right - defines the right operand
|
1676
|
+
* @param result - defines the Vector3 where to store the result
|
1677
|
+
*/
|
1678
|
+
export function crossToRef(left: ReadonlyVector3, right: ReadonlyVector3, result: MutableVector3): void;
|
1679
|
+
/**
|
1680
|
+
* Returns a new Vector3 set to (0.0, 0.0, 0.0)
|
1681
|
+
* @returns a new empty Vector3
|
1682
|
+
*/
|
1683
|
+
export function Zero(): MutableVector3;
|
1684
|
+
/**
|
1685
|
+
* Returns a new Vector3 set to (1.0, 1.0, 1.0)
|
1686
|
+
* @returns a new unit Vector3
|
1687
|
+
*/
|
1688
|
+
export function One(): MutableVector3;
|
1689
|
+
/**
|
1690
|
+
* Returns a new Vector3 set tolengthSquared (0.0, 1.0, 0.0)
|
1691
|
+
* @returns a new up Vector3
|
1692
|
+
*/
|
1693
|
+
export function Up(): MutableVector3;
|
1694
|
+
/**
|
1695
|
+
* Returns a new Vector3 set to (0.0, -1.0, 0.0)
|
1696
|
+
* @returns a new down Vector3
|
1697
|
+
*/
|
1698
|
+
export function Down(): MutableVector3;
|
1699
|
+
/**
|
1700
|
+
* Returns a new Vector3 set to (0.0, 0.0, 1.0)
|
1701
|
+
* @returns a new forward Vector3
|
1702
|
+
*/
|
1703
|
+
export function Forward(): MutableVector3;
|
1704
|
+
/**
|
1705
|
+
* Returns a new Vector3 set to (0.0, 0.0, -1.0)
|
1706
|
+
* @returns a new forward Vector3
|
1707
|
+
*/
|
1708
|
+
export function Backward(): MutableVector3;
|
1709
|
+
/**
|
1710
|
+
* Returns a new Vector3 set to (1.0, 0.0, 0.0)
|
1711
|
+
* @returns a new right Vector3
|
1712
|
+
*/
|
1713
|
+
export function Right(): MutableVector3;
|
1714
|
+
/**
|
1715
|
+
* Returns a new Vector3 set to (-1.0, 0.0, 0.0)
|
1716
|
+
* @returns a new left Vector3
|
1717
|
+
*/
|
1718
|
+
export function Left(): MutableVector3;
|
1719
|
+
}
|
1720
|
+
|
1721
|
+
export { }
|