@dcl/ecs 1.0.0-20220525093820.commit-c20b8cd → 1.0.0-20220601113849.commit-ab0b9fd

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