@defold-typescript/types 0.40.0 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/api-availability.json +3963 -772
  2. package/api-migrations.json +27 -0
  3. package/api-signatures.json +18069 -10240
  4. package/api-targets.json +448 -11
  5. package/examples/translations.json +560 -89
  6. package/fixtures/messages_doc.json +96 -0
  7. package/generated/b2d.d.ts +680 -4
  8. package/generated/b2d_body.d.ts +29 -103
  9. package/generated/b2d_chain.d.ts +5 -6
  10. package/generated/b2d_fixture.d.ts +34 -38
  11. package/generated/b2d_joint.d.ts +503 -25
  12. package/generated/b2d_shape.d.ts +183 -20
  13. package/generated/b2d_world.d.ts +57 -63
  14. package/generated/buffer.d.ts +16 -15
  15. package/generated/builtin-messages.d.ts +7 -1
  16. package/generated/bullet3d.d.ts +91 -0
  17. package/generated/bullet3d_collision_object.d.ts +433 -0
  18. package/generated/bullet3d_constraint.d.ts +818 -0
  19. package/generated/bullet3d_rigid_body.d.ts +429 -0
  20. package/generated/bullet3d_shape.d.ts +123 -0
  21. package/generated/bullet3d_world.d.ts +492 -0
  22. package/generated/camera.d.ts +29 -32
  23. package/generated/collectionfactory.d.ts +15 -18
  24. package/generated/collectionproxy.d.ts +22 -6
  25. package/generated/compute.d.ts +12 -238
  26. package/generated/crash.d.ts +24 -10
  27. package/generated/editor-vm/http.d.ts +90 -7
  28. package/generated/editor-vm/image.d.ts +7 -7
  29. package/generated/editor-vm/json.d.ts +11 -0
  30. package/generated/editor-vm/localization.d.ts +7 -7
  31. package/generated/editor-vm/tilemap_tiles.d.ts +56 -10
  32. package/generated/editor-vm/zip.d.ts +28 -0
  33. package/generated/editor.d.ts +1496 -430
  34. package/generated/factory.d.ts +21 -25
  35. package/generated/font.d.ts +64 -22
  36. package/generated/go.d.ts +235 -182
  37. package/generated/graphics.d.ts +335 -97
  38. package/generated/gui.d.ts +240 -471
  39. package/generated/html5.d.ts +2 -2
  40. package/generated/http.d.ts +28 -35
  41. package/generated/image.d.ts +105 -72
  42. package/generated/json.d.ts +34 -16
  43. package/generated/kinds/gui-script.d.ts +7 -0
  44. package/generated/kinds/render-script.d.ts +7 -0
  45. package/generated/kinds/script.d.ts +7 -0
  46. package/generated/label.d.ts +77 -7
  47. package/generated/liveupdate.d.ts +13 -10
  48. package/generated/material.d.ts +312 -360
  49. package/generated/model.d.ts +40 -39
  50. package/generated/particlefx.d.ts +19 -28
  51. package/generated/physics.d.ts +365 -133
  52. package/generated/profiler.d.ts +13 -23
  53. package/generated/render.d.ts +237 -297
  54. package/generated/resource.d.ts +664 -583
  55. package/generated/socket.d.ts +120 -133
  56. package/generated/sound.d.ts +62 -31
  57. package/generated/sprite.d.ts +31 -17
  58. package/generated/sys.d.ts +234 -190
  59. package/generated/tilemap.d.ts +21 -16
  60. package/generated/timer.d.ts +34 -21
  61. package/generated/versions/defold-1.12.4/b2d_body.d.ts +0 -7
  62. package/generated/versions/defold-1.12.4/buffer.d.ts +1 -3
  63. package/generated/versions/defold-1.12.4/camera.d.ts +21 -21
  64. package/generated/versions/defold-1.12.4/collectionfactory.d.ts +9 -9
  65. package/generated/versions/defold-1.12.4/collectionproxy.d.ts +2 -2
  66. package/generated/versions/defold-1.12.4/crash.d.ts +2 -2
  67. package/generated/versions/defold-1.12.4/factory.d.ts +15 -16
  68. package/generated/versions/defold-1.12.4/go.d.ts +6 -12
  69. package/generated/versions/defold-1.12.4/gui.d.ts +77 -175
  70. package/generated/versions/defold-1.12.4/html5.d.ts +1 -1
  71. package/generated/versions/defold-1.12.4/http.d.ts +0 -13
  72. package/generated/versions/defold-1.12.4/image.d.ts +16 -33
  73. package/generated/versions/defold-1.12.4/index.d.ts +1 -0
  74. package/generated/versions/defold-1.12.4/json.d.ts +10 -6
  75. package/generated/versions/defold-1.12.4/label.d.ts +2 -3
  76. package/generated/versions/defold-1.12.4/liveupdate.d.ts +5 -3
  77. package/generated/versions/defold-1.12.4/model.d.ts +2 -10
  78. package/generated/versions/defold-1.12.4/particlefx.d.ts +2 -5
  79. package/generated/versions/defold-1.12.4/physics.d.ts +69 -67
  80. package/generated/versions/defold-1.12.4/profiler.d.ts +2 -5
  81. package/generated/versions/defold-1.12.4/render.d.ts +99 -128
  82. package/generated/versions/defold-1.12.4/resource.d.ts +120 -148
  83. package/generated/versions/defold-1.12.4/socket.d.ts +34 -60
  84. package/generated/versions/defold-1.12.4/sound.d.ts +8 -8
  85. package/generated/versions/defold-1.12.4/sprite.d.ts +15 -5
  86. package/generated/versions/defold-1.12.4/sys.d.ts +37 -71
  87. package/generated/versions/defold-1.12.4/tilemap.d.ts +18 -11
  88. package/generated/versions/defold-1.12.4/timer.d.ts +5 -3
  89. package/generated/versions/defold-1.12.4/vmath.d.ts +0 -21
  90. package/generated/versions/defold-1.12.4/window.d.ts +1 -16
  91. package/generated/versions/defold-1.13.0/b2d_body.d.ts +10 -55
  92. package/generated/versions/defold-1.13.0/b2d_fixture.d.ts +25 -25
  93. package/generated/versions/defold-1.13.0/b2d_shape.d.ts +169 -8
  94. package/generated/versions/defold-1.13.0/b2d_world.d.ts +16 -10
  95. package/generated/versions/defold-1.13.0/buffer.d.ts +1 -3
  96. package/generated/versions/defold-1.13.0/camera.d.ts +25 -25
  97. package/generated/versions/defold-1.13.0/collectionfactory.d.ts +9 -9
  98. package/generated/versions/defold-1.13.0/collectionproxy.d.ts +2 -2
  99. package/generated/versions/defold-1.13.0/compute.d.ts +0 -69
  100. package/generated/versions/defold-1.13.0/crash.d.ts +2 -2
  101. package/generated/versions/defold-1.13.0/editor-vm/tilemap_tiles.d.ts +3 -3
  102. package/generated/versions/defold-1.13.0/editor.d.ts +34 -24
  103. package/generated/versions/defold-1.13.0/factory.d.ts +15 -16
  104. package/generated/versions/defold-1.13.0/go.d.ts +6 -12
  105. package/generated/versions/defold-1.13.0/graphics.d.ts +73 -37
  106. package/generated/versions/defold-1.13.0/gui.d.ts +77 -175
  107. package/generated/versions/defold-1.13.0/html5.d.ts +1 -1
  108. package/generated/versions/defold-1.13.0/http.d.ts +0 -13
  109. package/generated/versions/defold-1.13.0/image.d.ts +16 -33
  110. package/generated/versions/defold-1.13.0/index.d.ts +1 -0
  111. package/generated/versions/defold-1.13.0/json.d.ts +10 -6
  112. package/generated/versions/defold-1.13.0/label.d.ts +2 -3
  113. package/generated/versions/defold-1.13.0/liveupdate.d.ts +7 -5
  114. package/generated/versions/defold-1.13.0/material.d.ts +68 -106
  115. package/generated/versions/defold-1.13.0/model.d.ts +2 -10
  116. package/generated/versions/defold-1.13.0/particlefx.d.ts +2 -5
  117. package/generated/versions/defold-1.13.0/physics.d.ts +69 -67
  118. package/generated/versions/defold-1.13.0/profiler.d.ts +2 -5
  119. package/generated/versions/defold-1.13.0/render.d.ts +99 -128
  120. package/generated/versions/defold-1.13.0/resource.d.ts +126 -150
  121. package/generated/versions/defold-1.13.0/socket.d.ts +34 -60
  122. package/generated/versions/defold-1.13.0/sound.d.ts +8 -8
  123. package/generated/versions/defold-1.13.0/sprite.d.ts +15 -5
  124. package/generated/versions/defold-1.13.0/sys.d.ts +37 -71
  125. package/generated/versions/defold-1.13.0/tilemap.d.ts +18 -11
  126. package/generated/versions/defold-1.13.0/timer.d.ts +5 -3
  127. package/generated/versions/defold-1.13.0/vmath.d.ts +0 -21
  128. package/generated/versions/defold-1.13.0/window.d.ts +1 -16
  129. package/generated/versions/defold-1.13.1/b2d.d.ts +33 -0
  130. package/generated/versions/defold-1.13.1/b2d_body.d.ts +636 -0
  131. package/generated/versions/defold-1.13.1/b2d_chain.d.ts +106 -0
  132. package/generated/versions/defold-1.13.1/b2d_fixture.d.ts +157 -0
  133. package/generated/versions/defold-1.13.1/b2d_joint.d.ts +823 -0
  134. package/generated/versions/defold-1.13.1/b2d_shape.d.ts +400 -0
  135. package/generated/versions/defold-1.13.1/b2d_world.d.ts +320 -0
  136. package/generated/versions/defold-1.13.1/buffer.d.ts +189 -0
  137. package/generated/versions/defold-1.13.1/camera.d.ts +303 -0
  138. package/generated/versions/defold-1.13.1/collectionfactory.d.ts +151 -0
  139. package/generated/versions/defold-1.13.1/collectionproxy.d.ts +93 -0
  140. package/generated/versions/defold-1.13.1/compute.d.ts +237 -0
  141. package/generated/versions/defold-1.13.1/crash.d.ts +143 -0
  142. package/generated/versions/defold-1.13.1/editor-vm/http.d.ts +56 -0
  143. package/generated/versions/defold-1.13.1/editor-vm/image.d.ts +48 -0
  144. package/generated/versions/defold-1.13.1/editor-vm/json.d.ts +10 -0
  145. package/generated/versions/defold-1.13.1/editor-vm/localization.d.ts +42 -0
  146. package/generated/versions/defold-1.13.1/editor-vm/tilemap_tiles.d.ts +80 -0
  147. package/generated/versions/defold-1.13.1/editor-vm/zip.d.ts +10 -0
  148. package/generated/versions/defold-1.13.1/editor-vm/zlib.d.ts +24 -0
  149. package/generated/versions/defold-1.13.1/editor.d.ts +1121 -0
  150. package/generated/versions/defold-1.13.1/factory.d.ts +124 -0
  151. package/generated/versions/defold-1.13.1/font.d.ts +81 -0
  152. package/generated/versions/defold-1.13.1/go.d.ts +1107 -0
  153. package/generated/versions/defold-1.13.1/graphics.d.ts +411 -0
  154. package/generated/versions/defold-1.13.1/gui.d.ts +2353 -0
  155. package/generated/versions/defold-1.13.1/html5.d.ts +55 -0
  156. package/generated/versions/defold-1.13.1/http.d.ts +77 -0
  157. package/generated/versions/defold-1.13.1/image.d.ts +131 -0
  158. package/generated/versions/defold-1.13.1/index.d.ts +57 -0
  159. package/generated/versions/defold-1.13.1/json.d.ts +80 -0
  160. package/generated/versions/defold-1.13.1/kinds/editor-script.d.ts +14 -0
  161. package/generated/versions/defold-1.13.1/label.d.ts +93 -0
  162. package/generated/versions/defold-1.13.1/liveupdate.d.ts +142 -0
  163. package/generated/versions/defold-1.13.1/material.d.ts +408 -0
  164. package/generated/versions/defold-1.13.1/model.d.ts +272 -0
  165. package/generated/versions/defold-1.13.1/msg.d.ts +10 -0
  166. package/generated/versions/defold-1.13.1/particlefx.d.ts +163 -0
  167. package/generated/versions/defold-1.13.1/physics.d.ts +559 -0
  168. package/generated/versions/defold-1.13.1/profiler.d.ts +235 -0
  169. package/generated/versions/defold-1.13.1/render.d.ts +1190 -0
  170. package/generated/versions/defold-1.13.1/resource.d.ts +1523 -0
  171. package/generated/versions/defold-1.13.1/socket.d.ts +784 -0
  172. package/generated/versions/defold-1.13.1/sound.d.ts +292 -0
  173. package/generated/versions/defold-1.13.1/sprite.d.ts +175 -0
  174. package/generated/versions/defold-1.13.1/sys.d.ts +678 -0
  175. package/generated/versions/defold-1.13.1/tilemap.d.ts +208 -0
  176. package/generated/versions/defold-1.13.1/timer.d.ts +125 -0
  177. package/generated/versions/defold-1.13.1/types.d.ts +61 -0
  178. package/generated/versions/defold-1.13.1/vmath.d.ts +774 -0
  179. package/generated/versions/defold-1.13.1/window.d.ts +183 -0
  180. package/generated/versions/defold-1.13.1/zlib.d.ts +41 -0
  181. package/generated/vmath.d.ts +1 -21
  182. package/generated/window.d.ts +71 -71
  183. package/identity-vocabulary.json +561 -0
  184. package/index.d.ts +7 -0
  185. package/package.json +18 -2
  186. package/scripts/example-store-io.ts +12 -1
  187. package/scripts/extension-goldens.ts +1 -0
  188. package/scripts/fidelity-baseline.json +146 -46
  189. package/scripts/generate-api-availability.ts +90 -12
  190. package/scripts/generate-api-signatures.ts +12 -2
  191. package/scripts/import-defold-release.ts +106 -26
  192. package/scripts/prose-constants.ts +77 -16
  193. package/scripts/regen.ts +391 -77
  194. package/scripts/shared-handle-methods.ts +53 -0
  195. package/scripts/signature-store-fs.ts +1 -0
  196. package/scripts/sync-api-docs.ts +48 -10
  197. package/src/api-availability.ts +0 -0
  198. package/src/api-doc.ts +201 -3
  199. package/src/api-identity.ts +252 -0
  200. package/src/core-types.ts +26 -3
  201. package/src/correction-pins.ts +49 -0
  202. package/src/doc-comment.ts +104 -11
  203. package/src/doc-corrections.ts +108 -0
  204. package/src/editor-vm-globals.d.ts +5 -2
  205. package/src/emit-dts.ts +2064 -281
  206. package/src/emit-messages.ts +52 -0
  207. package/src/example-store.ts +125 -14
  208. package/src/field-correction-coverage.ts +204 -0
  209. package/src/fnv1a.ts +16 -0
  210. package/src/go-overloads.d.ts +25 -6
  211. package/src/index-base-table.ts +145 -0
  212. package/src/index-slot-classifications.ts +588 -0
  213. package/src/index.ts +38 -5
  214. package/src/library-index-slot-classifications.ts +332 -0
  215. package/src/lifecycle.ts +61 -199
  216. package/src/luals-type-expr.ts +354 -0
  217. package/src/msg-overloads.d.ts +0 -1
  218. package/src/param-correction-provenance.ts +8 -11
  219. package/src/render-overloads.d.ts +0 -15
  220. package/src/return-correction-provenance.ts +58 -16
  221. package/src/sys-overloads.d.ts +48 -0
  222. package/src/vmath-overloads.d.ts +27 -1
  223. package/src/window-event-guard.d.ts +6 -9
  224. package/url-parameters.json +1 -2
@@ -0,0 +1,774 @@
1
+ /** @noSelfInFile */
2
+ import type { Matrix4, Quaternion, Vector, Vector3, Vector4 } from "../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Functions for mathematical operations on vectors, matrices and quaternions.
7
+ *
8
+ * - The vector types (`vmath.vector3` and `vmath.vector4`) supports addition and subtraction
9
+ * with vectors of the same type. Vectors can be negated and multiplied (scaled) or divided by numbers.
10
+ * - The quaternion type (`vmath.quat`) supports multiplication with other quaternions.
11
+ * - The matrix type (`vmath.matrix4`) can be multiplied with numbers, other matrices
12
+ * and `vmath.vector4` values.
13
+ * - All types performs equality comparison by each component value.
14
+ *
15
+ * The following components are available for the various types:
16
+ *
17
+ * vector3
18
+ * : `x`, `y` and `z`. Example: `v.y`
19
+ *
20
+ * vector4
21
+ * : `x`, `y`, `z`, and `w`. Example: `v.w`
22
+ *
23
+ * quaternion
24
+ * : `x`, `y`, `z`, and `w`. Example: `q.w`
25
+ *
26
+ * matrix4
27
+ * : `m00` to `m33` where the first number is the row (starting from 0) and the second
28
+ * number is the column. Columns can be accessed with `c0` to `c3`, returning a `vector4`.
29
+ * Example: `m.m21` which is equal to `m.c1.z`
30
+ *
31
+ * vector
32
+ * : indexed by number 1 to the vector length. Example: `v[3]`
33
+ */
34
+ namespace vmath {
35
+ /**
36
+ * Calculates the conjugate of a quaternion. The result is a
37
+ * quaternion with the same magnitudes but with the sign of
38
+ * the imaginary (vector) parts changed:
39
+ * `q* = [w, -v]`
40
+ *
41
+ * @param q1 - quaternion of which to calculate the conjugate
42
+ * @returns the conjugate
43
+ * @example
44
+ * ```ts
45
+ * const quat = vmath.quat(1, 2, 3, 4);
46
+ * print(vmath.conj(quat)); // => vmath.quat(-1, -2, -3, 4)
47
+ * ```
48
+ */
49
+ function conj(q1: Quaternion): Quaternion;
50
+ /**
51
+ * Given two linearly independent vectors P and Q, the cross product,
52
+ * P × Q, is a vector that is perpendicular to both P and Q and
53
+ * therefore normal to the plane containing them.
54
+ * If the two vectors have the same direction (or have the exact
55
+ * opposite direction from one another, i.e. are not linearly independent)
56
+ * or if either one has zero length, then their cross product is zero.
57
+ *
58
+ * @param v1 - first vector
59
+ * @param v2 - second vector
60
+ * @returns a new vector representing the cross product
61
+ * @example
62
+ * ```ts
63
+ * const vec1 = vmath.vector3(1, 0, 0);
64
+ * const vec2 = vmath.vector3(0, 1, 0);
65
+ * print(vmath.cross(vec1, vec2)); // => vmath.vector3(0, 0, 1)
66
+ * const vec3 = vmath.vector3(-1, 0, 0);
67
+ * print(vmath.cross(vec1, vec3)); // => vmath.vector3(0, -0, 0)
68
+ * ```
69
+ */
70
+ function cross(v1: Vector3, v2: Vector3): Vector3;
71
+ /**
72
+ * The returned value is a scalar defined as:
73
+ * `P ⋅ Q = |P| |Q| cos θ`
74
+ * where θ is the angle between the vectors P and Q.
75
+ *
76
+ * - If the dot product is positive then the angle between the vectors is below 90 degrees.
77
+ * - If the dot product is zero the vectors are perpendicular (at right-angles to each other).
78
+ * - If the dot product is negative then the angle between the vectors is more than 90 degrees.
79
+ *
80
+ * @param v1 - first vector
81
+ * @param v2 - second vector
82
+ * @returns dot product
83
+ * @example
84
+ * ```ts
85
+ * const vector1 = vmath.vector3(1, 0, 0);
86
+ * const vector2 = vmath.vector3(0, 1, 0);
87
+ *
88
+ * if (vmath.dot(vector1, vector2) === 0) {
89
+ * // The two vectors are perpendicular (at right-angles to each other)
90
+ * // ...
91
+ * }
92
+ * ```
93
+ */
94
+ function dot(v1: Vector3 | Vector4, v2: Vector3 | Vector4): number;
95
+ /**
96
+ * The resulting matrix is the inverse of the supplied matrix.
97
+ * For ortho-normal matrices, e.g. regular object transformation,
98
+ * use `vmath.ortho_inv()` instead.
99
+ * The specialized inverse for ortho-normalized matrices is much faster
100
+ * than the general inverse.
101
+ *
102
+ * @param m1 - matrix to invert
103
+ * @returns inverse of the supplied matrix
104
+ * @example
105
+ * ```ts
106
+ * const mat1 = vmath.matrix4_rotation_z(3.141592653);
107
+ * const mat2 = vmath.inv(mat1);
108
+ * // M * inv(M) = identity matrix
109
+ * print(mat1.mul(mat2)); // => vmath.matrix4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
110
+ * ```
111
+ */
112
+ function inv(m1: Matrix4): Matrix4;
113
+ /**
114
+ * Returns the length of the supplied vector or quaternion.
115
+ * If you are comparing the lengths of vectors or quaternions, you should compare
116
+ * the length squared instead as it is slightly more efficient to calculate
117
+ * (it eliminates a square root calculation).
118
+ *
119
+ * @param v - value of which to calculate the length
120
+ * @returns length
121
+ * @example
122
+ * ```ts
123
+ * function below_max_speed(self: { velocity: Vector3 }, max_velocity: number) {
124
+ * if (vmath.length(self.velocity) < max_velocity) {
125
+ * // The speed (velocity vector) is below max.
126
+ *
127
+ * // TODO: max_velocity can be expressed as squared
128
+ * // so we can compare with length_sqr() instead.
129
+ * // ...
130
+ * }
131
+ * }
132
+ * ```
133
+ */
134
+ function length(v: Vector3 | Vector4 | Quaternion): number;
135
+ /**
136
+ * Returns the squared length of the supplied vector or quaternion.
137
+ *
138
+ * @param v - value of which to calculate the squared length
139
+ * @returns squared length
140
+ * @example
141
+ * ```ts
142
+ * const vector1 = vmath.vector3(1, 0, 0);
143
+ * const vector2 = vmath.vector3(0, 2, 0);
144
+ *
145
+ * if (vmath.length_sqr(vector1) < vmath.length_sqr(vector2)) {
146
+ * // Vector 1 has less magnitude than vector 2
147
+ * // ...
148
+ * }
149
+ * ```
150
+ */
151
+ function length_sqr(v: Vector3 | Vector4 | Quaternion): number;
152
+ /**
153
+ * The resulting identity matrix describes a transform with
154
+ * no translation or rotation.
155
+ *
156
+ * @returns identity matrix
157
+ * @example
158
+ * ```ts
159
+ * const mat = vmath.matrix4();
160
+ * print(mat); // => vmath.matrix4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
161
+ * // get column 0:
162
+ * print(mat.c0); // => vmath.vector4(1, 0, 0, 0)
163
+ * // get the value in row 3 and column 2:
164
+ * print(mat.m32); // => 0
165
+ * ```
166
+ */
167
+ function matrix4(): Matrix4;
168
+ /**
169
+ * Creates a new matrix with all components set to the
170
+ * corresponding values from the supplied matrix. I.e.
171
+ * the function creates a copy of the given matrix.
172
+ *
173
+ * @param m1 - existing matrix
174
+ * @returns matrix which is a copy of the specified matrix
175
+ * @example
176
+ * ```ts
177
+ * const mat1 = vmath.matrix4_rotation_x(3.141592653);
178
+ * const mat2 = vmath.matrix4(mat1);
179
+ * if (mat1 === mat2) {
180
+ * // yes, they are equal
181
+ * print(mat2); // => vmath.matrix4(1, 0, 0, 0, 0, -1, 8.7422776573476e-08, 0, 0, -8.7422776573476e-08, -1, 0, 0, 0, 0, 1)
182
+ * }
183
+ * ```
184
+ */
185
+ function matrix4(m1: Matrix4): Matrix4;
186
+ /**
187
+ * The resulting matrix describes a rotation around the axis by the specified angle.
188
+ *
189
+ * @param v - axis
190
+ * @param angle - angle in radians
191
+ * @returns matrix represented by axis and angle
192
+ * @example
193
+ * ```ts
194
+ * const vec = vmath.vector4(1, 1, 0, 0);
195
+ * const axis = vmath.vector3(0, 0, 1); // z-axis
196
+ * const mat = vmath.matrix4_axis_angle(axis, 3.141592653);
197
+ * print(mat.mul(vec)); // => vmath.vector4(-0.99999994039536, -1.0000001192093, 0, 0)
198
+ * ```
199
+ */
200
+ function matrix4_axis_angle(v: Vector3, angle: number): Matrix4;
201
+ /**
202
+ * Creates a new matrix constructed from separate
203
+ * translation vector, roation quaternion and scale vector
204
+ *
205
+ * @param translation - translation
206
+ * @param rotation - rotation
207
+ * @param scale - scale
208
+ * @returns new matrix4
209
+ * @example
210
+ * ```ts
211
+ * const translation = vmath.vector3(103, -95, 14);
212
+ * const quat = vmath.quat(1, 2, 3, 4);
213
+ * const scale = vmath.vector3(1, 0.5, 0.5);
214
+ * const result = vmath.matrix4_compose(translation, quat, scale);
215
+ * print(result); // => vmath.matrix4(-25, -10, 11, 103, 28, -9.5, 2, -95, -10, 10, -4.5, 14, 0, 0, 0, 1)
216
+ * ```
217
+ */
218
+ function matrix4_compose(translation: Vector3 | Vector4, rotation: Quaternion, scale: Vector3): Matrix4;
219
+ /**
220
+ * Constructs a frustum matrix from the given values. The left, right,
221
+ * top and bottom coordinates of the view cone are expressed as distances
222
+ * from the center of the near clipping plane. The near and far coordinates
223
+ * are expressed as distances from the tip of the view frustum cone.
224
+ *
225
+ * @param left - coordinate for left clipping plane
226
+ * @param right - coordinate for right clipping plane
227
+ * @param bottom - coordinate for bottom clipping plane
228
+ * @param top - coordinate for top clipping plane
229
+ * @param near - coordinate for near clipping plane
230
+ * @param far - coordinate for far clipping plane
231
+ * @returns matrix representing the frustum
232
+ * @example
233
+ * ```ts
234
+ * // Construct a projection frustum with a vertical and horizontal FOV of
235
+ * // 45 degrees. Useful for rendering a square view.
236
+ * const proj = vmath.matrix4_frustum(-1, 1, -1, 1, 1, 1000);
237
+ * render.set_projection(proj);
238
+ * ```
239
+ */
240
+ function matrix4_frustum(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix4;
241
+ /**
242
+ * The resulting matrix is created from the supplied look-at parameters.
243
+ * This is useful for constructing a view matrix for a camera or
244
+ * rendering in general.
245
+ *
246
+ * @param eye - eye position
247
+ * @param look_at - look-at position
248
+ * @param up - up vector
249
+ * @returns look-at matrix
250
+ * @example
251
+ * ```ts
252
+ * // Set up a perspective camera at z 100 with 45 degrees (pi/2) FOV, aspect ratio 4:3.
253
+ * const eye = vmath.vector3(0, 0, 100);
254
+ * const look_at = vmath.vector3(0, 0, 0);
255
+ * const up = vmath.vector3(0, 1, 0);
256
+ * const view = vmath.matrix4_look_at(eye, look_at, up);
257
+ * render.set_view(view);
258
+ * const proj = vmath.matrix4_perspective(3.141592 / 2, 4 / 3, 1, 1000);
259
+ * render.set_projection(proj);
260
+ * ```
261
+ */
262
+ function matrix4_look_at(eye: Vector3, look_at: Vector3, up: Vector3): Matrix4;
263
+ /**
264
+ * Creates an orthographic projection matrix.
265
+ * This is useful to construct a projection matrix for a camera or rendering in general.
266
+ *
267
+ * @param left - coordinate for left clipping plane
268
+ * @param right - coordinate for right clipping plane
269
+ * @param bottom - coordinate for bottom clipping plane
270
+ * @param top - coordinate for top clipping plane
271
+ * @param near - coordinate for near clipping plane
272
+ * @param far - coordinate for far clipping plane
273
+ * @returns orthographic projection matrix
274
+ * @example
275
+ * ```ts
276
+ * // Set up an orthographic projection based on the width and height of the
277
+ * // game window.
278
+ * const w = render.get_width();
279
+ * const h = render.get_height();
280
+ * const proj = vmath.matrix4_orthographic(-w / 2, w / 2, -h / 2, h / 2, -1000, 1000);
281
+ * render.set_projection(proj);
282
+ * ```
283
+ */
284
+ function matrix4_orthographic(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix4;
285
+ /**
286
+ * Creates a perspective projection matrix.
287
+ * This is useful to construct a projection matrix for a camera or rendering in general.
288
+ *
289
+ * @param fov - angle of the full vertical field of view in radians
290
+ * @param aspect - aspect ratio
291
+ * @param near - coordinate for near clipping plane
292
+ * @param far - coordinate for far clipping plane
293
+ * @returns perspective projection matrix
294
+ * @example
295
+ * ```ts
296
+ * // Set up a perspective camera at z 100 with 45 degrees (pi/2) FOV, aspect ratio 4:3.
297
+ * const eye = vmath.vector3(0, 0, 100);
298
+ * const look_at = vmath.vector3(0, 0, 0);
299
+ * const up = vmath.vector3(0, 1, 0);
300
+ * const view = vmath.matrix4_look_at(eye, look_at, up);
301
+ * render.set_view(view);
302
+ * const proj = vmath.matrix4_perspective(3.141592 / 2, 4 / 3, 1, 1000);
303
+ * render.set_projection(proj);
304
+ * ```
305
+ */
306
+ function matrix4_perspective(fov: number, aspect: number, near: number, far: number): Matrix4;
307
+ /**
308
+ * The resulting matrix describes the same rotation as the quaternion, but does not have any translation (also like the quaternion).
309
+ *
310
+ * @param q - quaternion to create matrix from
311
+ * @returns matrix represented by quaternion
312
+ * @example
313
+ * ```ts
314
+ * const vec = vmath.vector4(1, 1, 0, 0);
315
+ * const quat = vmath.quat_rotation_z(3.141592653);
316
+ * const mat = vmath.matrix4_quat(quat);
317
+ * print(mat.mul(vec)); // => vmath.matrix4_frustum(-1, 1, -1, 1, 1, 1000)
318
+ * ```
319
+ */
320
+ function matrix4_quat(q: Quaternion): Matrix4;
321
+ /**
322
+ * The resulting matrix describes a rotation around the x-axis
323
+ * by the specified angle.
324
+ *
325
+ * @param angle - angle in radians around x-axis
326
+ * @returns matrix from rotation around x-axis
327
+ * @example
328
+ * ```ts
329
+ * const vec = vmath.vector4(1, 1, 0, 0);
330
+ * const mat = vmath.matrix4_rotation_x(3.141592653);
331
+ * print(mat.mul(vec)); // => vmath.vector4(1, -1, -8.7422776573476e-08, 0)
332
+ * ```
333
+ */
334
+ function matrix4_rotation_x(angle: number): Matrix4;
335
+ /**
336
+ * The resulting matrix describes a rotation around the y-axis
337
+ * by the specified angle.
338
+ *
339
+ * @param angle - angle in radians around y-axis
340
+ * @returns matrix from rotation around y-axis
341
+ * @example
342
+ * ```ts
343
+ * const vec = vmath.vector4(1, 1, 0, 0);
344
+ * const mat = vmath.matrix4_rotation_y(3.141592653);
345
+ * print(mat.mul(vec)); // => vmath.vector4(-1, 1, 8.7422776573476e-08, 0)
346
+ * ```
347
+ */
348
+ function matrix4_rotation_y(angle: number): Matrix4;
349
+ /**
350
+ * The resulting matrix describes a rotation around the z-axis
351
+ * by the specified angle.
352
+ *
353
+ * @param angle - angle in radians around z-axis
354
+ * @returns matrix from rotation around z-axis
355
+ * @example
356
+ * ```ts
357
+ * const vec = vmath.vector4(1, 1, 0, 0);
358
+ * const mat = vmath.matrix4_rotation_z(3.141592653);
359
+ * print(mat.mul(vec)); // => vmath.vector4(-0.99999994039536, -1.0000001192093, 0, 0)
360
+ * ```
361
+ */
362
+ function matrix4_rotation_z(angle: number): Matrix4;
363
+ /**
364
+ * Creates a new matrix constructed from scale vector
365
+ *
366
+ * @param scale - scale
367
+ * @returns new matrix4
368
+ * @example
369
+ * ```ts
370
+ * const scale = vmath.vector3(1, 0.5, 0.5);
371
+ * const result = vmath.matrix4_scale(scale);
372
+ * print(result); // => vmath.matrix4(1, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 1)
373
+ * ```
374
+ */
375
+ function matrix4_scale(scale: Vector3): Matrix4;
376
+ /**
377
+ * creates a new matrix4 from uniform scale
378
+ *
379
+ * @param scale - scale
380
+ * @returns new matrix4
381
+ * @example
382
+ * ```ts
383
+ * const result = vmath.matrix4_scale(0.5);
384
+ * print(result); // => vmath.matrix4(0.5, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 1)
385
+ * ```
386
+ */
387
+ function matrix4_scale(scale: number): Matrix4;
388
+ /**
389
+ * Creates a new matrix4 from three scale components
390
+ *
391
+ * @param scale_x - scale along X axis
392
+ * @param scale_y - sclae along Y axis
393
+ * @param scale_z - scale along Z asis
394
+ * @returns new matrix4
395
+ * @example
396
+ * ```ts
397
+ * const result = vmath.matrix4_scale(1, 0.5, 0.5);
398
+ * print(result); // => vmath.matrix4(1, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 1)
399
+ * ```
400
+ */
401
+ function matrix4_scale(scale_x: number, scale_y: number, scale_z: number): Matrix4;
402
+ /**
403
+ * The resulting matrix describes a translation of a point
404
+ * in euclidean space.
405
+ *
406
+ * @param position - position vector to create matrix from
407
+ * @returns matrix from the supplied position vector
408
+ * @example
409
+ * ```ts
410
+ * // Set camera view from custom view and translation matrices.
411
+ * const mat_trans = vmath.matrix4_translation(vmath.vector3(0, 10, 100));
412
+ * const mat_view = vmath.matrix4_rotation_y(-3.141592 / 4);
413
+ * render.set_view(mat_view.mul(mat_trans));
414
+ * ```
415
+ */
416
+ function matrix4_translation(position: Vector3 | Vector4): Matrix4;
417
+ /**
418
+ * The resulting matrix is the inverse of the supplied matrix.
419
+ * The supplied matrix has to be an ortho-normal matrix, e.g.
420
+ * describe a regular object transformation.
421
+ * For matrices that are not ortho-normal
422
+ * use the general inverse `vmath.inv()` instead.
423
+ *
424
+ * @param m1 - ortho-normalized matrix to invert
425
+ * @returns inverse of the supplied matrix
426
+ * @example
427
+ * ```ts
428
+ * const mat1 = vmath.matrix4_rotation_z(3.141592653);
429
+ * const mat2 = vmath.ortho_inv(mat1);
430
+ * // M * inv(M) = identity matrix
431
+ * print(mat1.mul(mat2)); // => vmath.matrix4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
432
+ * ```
433
+ */
434
+ function ortho_inv(m1: Matrix4): Matrix4;
435
+ /**
436
+ * Calculates the extent the projection of the first vector onto the second.
437
+ * The returned value is a scalar p defined as:
438
+ * `p = |P| cos θ / |Q|`
439
+ * where θ is the angle between the vectors P and Q.
440
+ *
441
+ * @param v1 - vector to be projected on the second
442
+ * @param v2 - vector onto which the first will be projected, must not have zero length
443
+ * @returns the projected extent of the first vector onto the second
444
+ * @example
445
+ * ```ts
446
+ * const v1 = vmath.vector3(1, 1, 0);
447
+ * const v2 = vmath.vector3(2, 0, 0);
448
+ * print(vmath.project(v1, v2)); // => 0.5
449
+ * ```
450
+ */
451
+ function project(v1: Vector3, v2: Vector3): number;
452
+ /**
453
+ * Creates a new identity quaternion. The identity
454
+ * quaternion is equal to:
455
+ * `vmath.quat(0, 0, 0, 1)`
456
+ *
457
+ * @returns new identity quaternion
458
+ * @example
459
+ * ```ts
460
+ * const quat = vmath.quat();
461
+ * print(quat); // => vmath.quat(0, 0, 0, 1)
462
+ * print(quat.w); // => 1
463
+ * ```
464
+ */
465
+ function quat(): Quaternion;
466
+ /**
467
+ * Creates a new quaternion with all components set to the
468
+ * corresponding values from the supplied quaternion. I.e.
469
+ * This function creates a copy of the given quaternion.
470
+ *
471
+ * @param q1 - existing quaternion
472
+ * @returns new quaternion
473
+ * @example
474
+ * ```ts
475
+ * const quat1 = vmath.quat(1, 2, 3, 4);
476
+ * const quat2 = vmath.quat(quat1);
477
+ * if (quat1 === quat2) {
478
+ * // yes, they are equal
479
+ * print(quat2); // => vmath.quat(1, 2, 3, 4)
480
+ * }
481
+ * ```
482
+ */
483
+ function quat(q1: Quaternion): Quaternion;
484
+ /**
485
+ * Creates a new quaternion with the components set
486
+ * according to the supplied parameter values.
487
+ *
488
+ * @param x - x coordinate
489
+ * @param y - y coordinate
490
+ * @param z - z coordinate
491
+ * @param w - w coordinate
492
+ * @returns new quaternion
493
+ * @example
494
+ * ```ts
495
+ * const quat = vmath.quat(1, 2, 3, 4);
496
+ * print(quat); // => vmath.quat(1, 2, 3, 4)
497
+ * ```
498
+ */
499
+ function quat(x: number, y: number, z: number, w: number): Quaternion;
500
+ /**
501
+ * The resulting quaternion describes a rotation of `angle`
502
+ * radians around the axis described by the unit vector `v`.
503
+ *
504
+ * @param v - axis
505
+ * @param angle - angle
506
+ * @returns quaternion representing the axis-angle rotation
507
+ * @example
508
+ * ```ts
509
+ * const axis = vmath.vector3(1, 0, 0);
510
+ * const rot = vmath.quat_axis_angle(axis, 3.141592653);
511
+ * const vec = vmath.vector3(1, 1, 0);
512
+ * print(vmath.rotate(rot, vec)); // => vmath.vector3(1, -1, -8.7422776573476e-08)
513
+ * ```
514
+ */
515
+ function quat_axis_angle(v: Vector3, angle: number): Quaternion;
516
+ /**
517
+ * The resulting quaternion describes the rotation from the
518
+ * identity quaternion (no rotation) to the coordinate system
519
+ * as described by the given x, y and z base unit vectors.
520
+ *
521
+ * @param x - x base vector
522
+ * @param y - y base vector
523
+ * @param z - z base vector
524
+ * @returns quaternion representing the rotation of the specified base vectors
525
+ * @example
526
+ * ```ts
527
+ * // Axis rotated 90 degrees around z.
528
+ * const rot_x = vmath.vector3(0, -1, 0);
529
+ * const rot_y = vmath.vector3(1, 0, 0);
530
+ * const z = vmath.vector3(0, 0, 1);
531
+ * const rot1 = vmath.quat_basis(rot_x, rot_y, z);
532
+ * const rot2 = vmath.quat_from_to(vmath.vector3(0, 1, 0), vmath.vector3(1, 0, 0));
533
+ * if (rot1 === rot2) {
534
+ * // These quaternions are equal!
535
+ * print(rot2); // => vmath.quat(0, 0, -0.70710676908493, 0.70710676908493)
536
+ * }
537
+ * ```
538
+ */
539
+ function quat_basis(x: Vector3, y: Vector3, z: Vector3): Quaternion;
540
+ /**
541
+ * The resulting quaternion describes the rotation that,
542
+ * if applied to the first vector, would rotate the first
543
+ * vector to the second. The two vectors must be unit
544
+ * vectors (of length 1).
545
+ * The result is undefined if the two vectors point in opposite directions
546
+ *
547
+ * @param v1 - first unit vector, before rotation
548
+ * @param v2 - second unit vector, after rotation
549
+ * @returns quaternion representing the rotation from first to second vector
550
+ * @example
551
+ * ```ts
552
+ * const v1 = vmath.vector3(1, 0, 0);
553
+ * const v2 = vmath.vector3(0, 1, 0);
554
+ * const rot = vmath.quat_from_to(v1, v2);
555
+ * print(vmath.rotate(rot, v1)); // => vmath.vector3(0, 0.99999994039536, 0)
556
+ * ```
557
+ */
558
+ function quat_from_to(v1: Vector3, v2: Vector3): Quaternion;
559
+ /**
560
+ * Creates a new quaternion with the components set
561
+ * according to the supplied parameter values.
562
+ *
563
+ * @param matrix - source matrix4
564
+ * @returns new quaternion
565
+ */
566
+ function quat_matrix4(matrix: Matrix4): Quaternion;
567
+ /**
568
+ * The resulting quaternion describes a rotation of `angle`
569
+ * radians around the x-axis.
570
+ *
571
+ * @param angle - angle in radians around x-axis
572
+ * @returns quaternion representing the rotation around the x-axis
573
+ * @example
574
+ * ```ts
575
+ * const rot = vmath.quat_rotation_x(3.141592653);
576
+ * const vec = vmath.vector3(1, 1, 0);
577
+ * print(vmath.rotate(rot, vec)); // => vmath.vector3(1, -1, -8.7422776573476e-08)
578
+ * ```
579
+ */
580
+ function quat_rotation_x(angle: number): Quaternion;
581
+ /**
582
+ * The resulting quaternion describes a rotation of `angle`
583
+ * radians around the y-axis.
584
+ *
585
+ * @param angle - angle in radians around y-axis
586
+ * @returns quaternion representing the rotation around the y-axis
587
+ * @example
588
+ * ```ts
589
+ * const rot = vmath.quat_rotation_y(3.141592653);
590
+ * const vec = vmath.vector3(1, 1, 0);
591
+ * print(vmath.rotate(rot, vec)); // => vmath.vector3(-1, 1, 8.7422776573476e-08)
592
+ * ```
593
+ */
594
+ function quat_rotation_y(angle: number): Quaternion;
595
+ /**
596
+ * The resulting quaternion describes a rotation of `angle`
597
+ * radians around the z-axis.
598
+ *
599
+ * @param angle - angle in radians around z-axis
600
+ * @returns quaternion representing the rotation around the z-axis
601
+ * @example
602
+ * ```ts
603
+ * const rot = vmath.quat_rotation_z(3.141592653);
604
+ * const vec = vmath.vector3(1, 1, 0);
605
+ * print(vmath.rotate(rot, vec)); // => vmath.vector3(-0.99999988079071, -1, 0)
606
+ * ```
607
+ */
608
+ function quat_rotation_z(angle: number): Quaternion;
609
+ /**
610
+ * Converts a quaternion into euler angles (r0, r1, r2), based on YZX rotation order.
611
+ * To handle gimbal lock (singularity at r1 ~ +/- 90 degrees), the cut off is at r0 = +/- 88.85 degrees, which snaps to +/- 90.
612
+ * The provided quaternion is expected to be normalized.
613
+ * The error is guaranteed to be less than +/- 0.02 degrees
614
+ *
615
+ * @param q - source quaternion
616
+ * @example
617
+ * ```ts
618
+ * const q = vmath.quat_rotation_z(math.rad(90));
619
+ * print(vmath.quat_to_euler(q)); // => 0 0 90
620
+ *
621
+ * const q2 = vmath.quat_rotation_y(math.rad(45)).mul(vmath.quat_rotation_z(math.rad(90)));
622
+ * const [ex, ey, ez] = vmath.quat_to_euler(q2);
623
+ * const v = vmath.vector3(ex, ey, ez);
624
+ * print(v); // => vmath.vector3(0, 45, 90)
625
+ * ```
626
+ */
627
+ function quat_to_euler(q: Quaternion): LuaMultiReturn<[number, number, number]>;
628
+ /**
629
+ * Returns a new vector from the supplied vector that is
630
+ * rotated by the rotation described by the supplied
631
+ * quaternion.
632
+ *
633
+ * @param q - quaternion
634
+ * @param v1 - vector to rotate
635
+ * @returns the rotated vector
636
+ * @example
637
+ * ```ts
638
+ * const vec = vmath.vector3(1, 1, 0);
639
+ * const rot = vmath.quat_rotation_z(3.141592563);
640
+ * print(vmath.rotate(rot, vec)); // => vmath.vector3(-1.0000002384186, -0.99999988079071, 0)
641
+ * ```
642
+ */
643
+ function rotate(q: Quaternion, v1: Vector3): Vector3;
644
+ /**
645
+ * Creates a new zero vector with all components set to 0.
646
+ *
647
+ * @returns new zero vector
648
+ * @example
649
+ * ```ts
650
+ * const vec = vmath.vector3();
651
+ * pprint(vec); // => vmath.vector3(0, 0, 0)
652
+ * print(vec.x); // => 0
653
+ * ```
654
+ */
655
+ function vector3(): Vector3;
656
+ /**
657
+ * Creates a new vector with all components set to the
658
+ * supplied scalar value.
659
+ *
660
+ * @param n - scalar value to splat
661
+ * @returns new vector
662
+ * @example
663
+ * ```ts
664
+ * const vec = vmath.vector3(1.0);
665
+ * print(vec); // => vmath.vector3(1, 1, 1)
666
+ * print(vec.x); // => 1
667
+ * ```
668
+ */
669
+ function vector3(n: number): Vector3;
670
+ /**
671
+ * Creates a new vector with all components set to the
672
+ * corresponding values from the supplied vector. I.e.
673
+ * This function creates a copy of the given vector.
674
+ *
675
+ * @param v1 - existing vector
676
+ * @returns new vector
677
+ * @example
678
+ * ```ts
679
+ * const vec1 = vmath.vector3(1.0);
680
+ * const vec2 = vmath.vector3(vec1);
681
+ * if (vec1 === vec2) {
682
+ * // yes, they are equal
683
+ * print(vec2); // => vmath.vector3(1, 1, 1)
684
+ * }
685
+ * ```
686
+ */
687
+ function vector3(v1: Vector3): Vector3;
688
+ /**
689
+ * Creates a new vector with the components set to the
690
+ * supplied values.
691
+ *
692
+ * @param x - x coordinate
693
+ * @param y - y coordinate
694
+ * @param z - z coordinate
695
+ * @returns new vector
696
+ * @example
697
+ * ```ts
698
+ * const vec = vmath.vector3(1.0, 2.0, 3.0);
699
+ * print(vec); // => vmath.vector3(1, 2, 3)
700
+ * print(vec.unm()); // => vmath.vector3(-1, -2, -3)
701
+ * print(vec.mul(2)); // => vmath.vector3(2, 4, 6)
702
+ * print(vec.add(vmath.vector3(2.0))); // => vmath.vector3(3, 4, 5)
703
+ * print(vec.sub(vmath.vector3(2.0))); // => vmath.vector3(-1, 0, 1)
704
+ * ```
705
+ */
706
+ function vector3(x: number, y: number, z: number): Vector3;
707
+ /**
708
+ * Creates a new zero vector with all components set to 0.
709
+ *
710
+ * @returns new zero vector
711
+ * @example
712
+ * ```ts
713
+ * const vec = vmath.vector4();
714
+ * print(vec); // => vmath.vector4(0, 0, 0, 0)
715
+ * print(vec.w); // => 0
716
+ * ```
717
+ */
718
+ function vector4(): Vector4;
719
+ /**
720
+ * Creates a new vector with all components set to the
721
+ * supplied scalar value.
722
+ *
723
+ * @param n - scalar value to splat
724
+ * @returns new vector
725
+ * @example
726
+ * ```ts
727
+ * const vec = vmath.vector4(1.0);
728
+ * print(vec); // => vmath.vector4(1, 1, 1, 1)
729
+ * print(vec.w); // => 1
730
+ * ```
731
+ */
732
+ function vector4(n: number): Vector4;
733
+ /**
734
+ * Creates a new vector with all components set to the
735
+ * corresponding values from the supplied vector. I.e.
736
+ * This function creates a copy of the given vector.
737
+ *
738
+ * @param v1 - existing vector
739
+ * @returns new vector
740
+ * @example
741
+ * ```ts
742
+ * const vec1 = vmath.vector4(1.0);
743
+ * const vec2 = vmath.vector4(vec1);
744
+ * if (vec1 === vec2) {
745
+ * // yes, they are equal
746
+ * print(vec2); // => vmath.vector4(1, 1, 1, 1)
747
+ * }
748
+ * ```
749
+ */
750
+ function vector4(v1: Vector4): Vector4;
751
+ /**
752
+ * Creates a new vector with the components set to the
753
+ * supplied values.
754
+ *
755
+ * @param x - x coordinate
756
+ * @param y - y coordinate
757
+ * @param z - z coordinate
758
+ * @param w - w coordinate
759
+ * @returns new vector
760
+ * @example
761
+ * ```ts
762
+ * const vec = vmath.vector4(1.0, 2.0, 3.0, 4.0);
763
+ * print(vec); // => vmath.vector4(1, 2, 3, 4)
764
+ * print(vec.unm()); // => vmath.vector4(-1, -2, -3, -4)
765
+ * print(vec.mul(2)); // => vmath.vector4(2, 4, 6, 8)
766
+ * print(vec.add(vmath.vector4(2.0))); // => vmath.vector4(3, 4, 5, 6)
767
+ * print(vec.sub(vmath.vector4(2.0))); // => vmath.vector4(-1, 0, 1, 2)
768
+ * ```
769
+ */
770
+ function vector4(x: number, y: number, z: number, w: number): Vector4;
771
+ }
772
+ }
773
+
774
+ export {};