@defold-typescript/types 0.19.4 → 0.20.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 (86) hide show
  1. package/api-availability.json +2755 -0
  2. package/api-migrations.json +31 -0
  3. package/api-signatures.json +2324 -0
  4. package/api-targets.json +493 -45
  5. package/generated/b2d.d.ts +6 -0
  6. package/generated/b2d_body.d.ts +329 -1
  7. package/generated/b2d_chain.d.ts +106 -0
  8. package/generated/b2d_fixture.d.ts +155 -0
  9. package/generated/b2d_joint.d.ts +823 -0
  10. package/generated/b2d_shape.d.ts +215 -0
  11. package/generated/b2d_world.d.ts +314 -0
  12. package/generated/builtin-messages.d.ts +18 -0
  13. package/generated/camera.d.ts +62 -5
  14. package/generated/compute.d.ts +306 -0
  15. package/generated/go.d.ts +29 -4
  16. package/generated/graphics.d.ts +95 -0
  17. package/generated/gui.d.ts +1 -3
  18. package/generated/json.d.ts +2 -2
  19. package/generated/kinds/gui-script.d.ts +7 -0
  20. package/generated/kinds/render-script.d.ts +7 -0
  21. package/generated/kinds/script.d.ts +7 -0
  22. package/generated/label.d.ts +1 -1
  23. package/generated/liveupdate.d.ts +22 -4
  24. package/generated/material.d.ts +444 -0
  25. package/generated/model.d.ts +46 -5
  26. package/generated/physics.d.ts +1 -3
  27. package/generated/profiler.d.ts +2 -3
  28. package/generated/render.d.ts +25 -9
  29. package/generated/resource.d.ts +2 -2
  30. package/generated/sprite.d.ts +15 -1
  31. package/generated/tilemap.d.ts +14 -0
  32. package/generated/versions/defold-1.12.4/b2d.d.ts +27 -0
  33. package/generated/versions/defold-1.12.4/b2d_body.d.ts +348 -0
  34. package/generated/versions/defold-1.12.4/buffer.d.ts +176 -0
  35. package/generated/versions/defold-1.12.4/camera.d.ts +245 -0
  36. package/generated/versions/defold-1.12.4/collectionfactory.d.ts +146 -0
  37. package/generated/versions/defold-1.12.4/collectionproxy.d.ts +71 -0
  38. package/generated/versions/defold-1.12.4/crash.d.ts +143 -0
  39. package/generated/versions/defold-1.12.4/factory.d.ts +123 -0
  40. package/generated/versions/defold-1.12.4/font.d.ts +81 -0
  41. package/generated/versions/defold-1.12.4/go.d.ts +1029 -0
  42. package/generated/versions/defold-1.12.4/graphics.d.ts +226 -0
  43. package/generated/versions/defold-1.12.4/gui.d.ts +2372 -0
  44. package/generated/versions/defold-1.12.4/html5.d.ts +53 -0
  45. package/generated/versions/defold-1.12.4/http.d.ts +84 -0
  46. package/generated/versions/defold-1.12.4/iac.d.ts +18 -0
  47. package/generated/versions/defold-1.12.4/iap.d.ts +60 -0
  48. package/generated/versions/defold-1.12.4/image.d.ts +139 -0
  49. package/generated/versions/defold-1.12.4/index.d.ts +41 -0
  50. package/generated/versions/defold-1.12.4/json.d.ts +76 -0
  51. package/generated/versions/defold-1.12.4/label.d.ts +94 -0
  52. package/generated/versions/defold-1.12.4/liveupdate.d.ts +122 -0
  53. package/generated/versions/defold-1.12.4/model.d.ts +205 -0
  54. package/generated/versions/defold-1.12.4/msg.d.ts +10 -0
  55. package/generated/versions/defold-1.12.4/particlefx.d.ts +166 -0
  56. package/generated/versions/defold-1.12.4/physics.d.ts +547 -0
  57. package/generated/versions/defold-1.12.4/profiler.d.ts +234 -0
  58. package/generated/versions/defold-1.12.4/push.d.ts +66 -0
  59. package/generated/versions/defold-1.12.4/render.d.ts +1149 -0
  60. package/generated/versions/defold-1.12.4/resource.d.ts +1518 -0
  61. package/generated/versions/defold-1.12.4/socket.d.ts +795 -0
  62. package/generated/versions/defold-1.12.4/sound.d.ts +291 -0
  63. package/generated/versions/defold-1.12.4/sprite.d.ts +143 -0
  64. package/generated/versions/defold-1.12.4/sys.d.ts +695 -0
  65. package/generated/versions/defold-1.12.4/tilemap.d.ts +181 -0
  66. package/generated/versions/defold-1.12.4/timer.d.ts +114 -0
  67. package/generated/versions/defold-1.12.4/types.d.ts +61 -0
  68. package/generated/versions/defold-1.12.4/vmath.d.ts +806 -0
  69. package/generated/versions/defold-1.12.4/webview.d.ts +68 -0
  70. package/generated/versions/defold-1.12.4/window.d.ts +198 -0
  71. package/generated/versions/defold-1.12.4/zlib.d.ts +40 -0
  72. package/index.d.ts +22 -0
  73. package/package.json +8 -1
  74. package/scripts/fidelity-audit.ts +69 -12
  75. package/scripts/fidelity-baseline.json +56 -0
  76. package/scripts/generate-api-availability.ts +139 -0
  77. package/scripts/generate-api-signatures.ts +66 -0
  78. package/scripts/import-defold-release.ts +480 -0
  79. package/scripts/regen.ts +53 -6
  80. package/scripts/sync-api-docs.ts +89 -41
  81. package/src/api-availability.ts +0 -0
  82. package/src/core-types.ts +9 -0
  83. package/src/emit-dts.ts +674 -17
  84. package/src/emit-messages.ts +72 -2
  85. package/src/index.ts +26 -1
  86. package/src/lifecycle.ts +43 -2
@@ -2,10 +2,16 @@
2
2
  /// <reference types="lua-types/special/jit-only" />
3
3
  import "../b2d";
4
4
  import "../b2d_body";
5
+ import "../b2d_chain";
6
+ import "../b2d_fixture";
7
+ import "../b2d_joint";
8
+ import "../b2d_shape";
9
+ import "../b2d_world";
5
10
  import "../buffer";
6
11
  import "../camera";
7
12
  import "../collectionfactory";
8
13
  import "../collectionproxy";
14
+ import "../compute";
9
15
  import "../crash";
10
16
  import "../factory";
11
17
  import "../font";
@@ -19,6 +25,7 @@ import "../image";
19
25
  import "../json";
20
26
  import "../label";
21
27
  import "../liveupdate";
28
+ import "../material";
22
29
  import "../model";
23
30
  import "../msg";
24
31
  import "../particlefx";
@@ -3,7 +3,7 @@ import type { Hash, Url, Vector3, Vector4 } from "../src/core-types";
3
3
 
4
4
  declare global {
5
5
  /**
6
- * Functions to manipulate a label component.
6
+ * Label API documentation
7
7
  */
8
8
  namespace label {
9
9
  /**
@@ -1,4 +1,6 @@
1
1
  /** @noSelfInFile */
2
+ import type { Hash } from "../src/core-types";
3
+
2
4
  declare global {
3
5
  /**
4
6
  * Functions and constants to access resources.
@@ -58,13 +60,15 @@ declare global {
58
60
  const LIVEUPDATE_VERSION_MISMATCH: number & { readonly __brand: "liveupdate.LIVEUPDATE_VERSION_MISMATCH" };
59
61
  /**
60
62
  * Adds a resource mount to the resource system.
61
- * The mounts are persisted between sessions.
62
63
  * After the mount succeeded, the resources are available to load. (i.e. no reboot required)
63
64
  *
64
65
  * @param name - Unique name of the mount
65
66
  * @param uri - The uri of the mount, including the scheme. Currently supported schemes are 'zip' and 'archive'.
66
67
  * @param priority - Priority of mount. Larger priority takes prescedence
67
68
  * @param callback - Callback after the asynchronous request completed
69
+ * - `name` hash Unique name of the mount
70
+ * - `uri` string The uri of the mount
71
+ * - `result` number The result of the request
68
72
  * @returns The result of the request
69
73
  * @example
70
74
  * ```ts
@@ -74,7 +78,7 @@ declare global {
74
78
  * liveupdate.add_mount("season_pack_1", "zip:/path/to/easter_pack_1.zip", 30, (result) => {}); // season pack, overriding content in the other packs
75
79
  * ```
76
80
  */
77
- function add_mount(name: string, uri: string, priority: number, callback: (...args: unknown[]) => unknown): number;
81
+ function add_mount(name: string | Hash, uri: string, priority: number, callback: (self: unknown, name: unknown, uri: unknown, result: unknown) => void): number;
78
82
  /**
79
83
  * Get an array of the current mounts
80
84
  * This can be used to determine if a new mount is needed or not
@@ -102,9 +106,23 @@ declare global {
102
106
  * ```
103
107
  */
104
108
  function get_mounts(): { name: string; uri: string; priority: number }[];
109
+ /**
110
+ * Checks if the bundled application was built with one or more resources
111
+ * excluded from the main bundle, through a collection proxy with
112
+ * `Exclude` enabled.
113
+ * This value is based on metadata in the bundled manifest. It does not check
114
+ * whether any live update archive has been mounted or whether the excluded
115
+ * resources are currently available on device.
116
+ *
117
+ * @returns true if the bundled application was built with excluded files
118
+ * @example
119
+ * ```ts
120
+ * if (liveupdate.is_built_with_excluded_files()) print("The bundle expects live update content.");
121
+ * ```
122
+ */
123
+ function is_built_with_excluded_files(): boolean;
105
124
  /**
106
125
  * Remove a mount the resource system.
107
- * The remaining mounts are persisted between sessions.
108
126
  * Removing a mount does not affect any loaded resources.
109
127
  *
110
128
  * @param name - Unique name of the mount
@@ -115,7 +133,7 @@ declare global {
115
133
  * liveupdate.remove_mount("season_pack_1");
116
134
  * ```
117
135
  */
118
- function remove_mount(name: string): number;
136
+ function remove_mount(name: string | Hash): number;
119
137
  }
120
138
  }
121
139
 
@@ -0,0 +1,444 @@
1
+ /** @noSelfInFile */
2
+ import type { Hash, Matrix4, Vector3, Vector4 } from "../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Functions for interacting with materials.
7
+ */
8
+ namespace material {
9
+ /**
10
+ * Returns a table of all the shader constants in the material. This function will return all the shader constants
11
+ * that are used in both the vertex and the fragment shaders.
12
+ *
13
+ * @param path - The path to the resource
14
+ * @returns A table of tables, where each entry contains info about the shader constants:
15
+ *
16
+ * `name`
17
+ * hash the hashed name of the constant
18
+ * `type`
19
+ * number the type of the constant. Supported values:
20
+ *
21
+ * - `material.CONSTANT_TYPE_USER`
22
+ *
23
+ * - `material.CONSTANT_TYPE_USER_MATRIX4`
24
+ *
25
+ * - `material.CONSTANT_TYPE_VIEWPROJ`
26
+ *
27
+ * - `material.CONSTANT_TYPE_WORLD`
28
+ *
29
+ * - `material.CONSTANT_TYPE_TEXTURE`
30
+ *
31
+ * - `material.CONSTANT_TYPE_VIEW`
32
+ *
33
+ * - `material.CONSTANT_TYPE_PROJECTION`
34
+ *
35
+ * - `material.CONSTANT_TYPE_NORMAL`
36
+ *
37
+ * - `material.CONSTANT_TYPE_WORLDVIEW`
38
+ *
39
+ * - `material.CONSTANT_TYPE_WORLDVIEWPROJ`
40
+ *
41
+ * - `material.CONSTANT_TYPE_TIME`
42
+ *
43
+ * - `material.CONSTANT_TYPE_WORLD_INVERSE`
44
+ *
45
+ * - `material.CONSTANT_TYPE_VIEW_INVERSE`
46
+ *
47
+ * - `material.CONSTANT_TYPE_PROJECTION_INVERSE`
48
+ *
49
+ * - `material.CONSTANT_TYPE_VIEWPROJ_INVERSE`
50
+ *
51
+ * - `material.CONSTANT_TYPE_WORLDVIEW_INVERSE`
52
+ *
53
+ * - `material.CONSTANT_TYPE_WORLDVIEWPROJ_INVERSE`
54
+ *
55
+ * `value`
56
+ * vmath.vector4 | vmath.matrix4 the value(s) of the constant. If the constant is an array, the value will be a table of vmath.vector4 or vmath.matrix4 if the type is `material.CONSTANT_TYPE_USER_MATRIX4`.
57
+ * @example
58
+ * ```ts
59
+ * const constants = material.get_constants(resource.material("/my_material.materialc"));
60
+ * ```
61
+ */
62
+ function get_constants(path: Hash | string): { name: Hash; type: number; value: Vector4 | Matrix4 }[];
63
+ /**
64
+ * Returns a table of all the texture samplers in the material. This function will return all the texture samplers
65
+ * that are used in both the vertex and the fragment shaders.
66
+ *
67
+ * @param path - The path to the resource
68
+ * @returns A table of tables, where each entry contains info about the texture samplers:
69
+ *
70
+ * `name`
71
+ * hash the hashed name of the texture sampler
72
+ * `u_wrap`
73
+ * number the u wrap mode of the texture sampler. Supported values:
74
+ *
75
+ * - `graphics.TEXTURE_WRAP_CLAMP_TO_BORDER`
76
+ *
77
+ * - `graphics.TEXTURE_WRAP_CLAMP_TO_EDGE`
78
+ *
79
+ * - `graphics.TEXTURE_WRAP_MIRRORED_REPEAT`
80
+ *
81
+ * - `graphics.TEXTURE_WRAP_REPEAT`
82
+ *
83
+ * `v_wrap`
84
+ * number the v wrap mode of the texture sampler. Supported values:
85
+ *
86
+ * - `graphics.TEXTURE_WRAP_CLAMP_TO_BORDER`
87
+ *
88
+ * - `graphics.TEXTURE_WRAP_CLAMP_TO_EDGE`
89
+ *
90
+ * - `graphics.TEXTURE_WRAP_MIRRORED_REPEAT`
91
+ *
92
+ * - `graphics.TEXTURE_WRAP_REPEAT`
93
+ *
94
+ * `min_filter`
95
+ * number the min filter mode of the texture sampler. Supported values:
96
+ *
97
+ * - `graphics.TEXTURE_FILTER_DEFAULT`
98
+ *
99
+ * - `graphics.TEXTURE_FILTER_NEAREST`
100
+ *
101
+ * - `graphics.TEXTURE_FILTER_LINEAR`
102
+ *
103
+ * - `graphics.TEXTURE_FILTER_NEAREST_MIPMAP_NEAREST`
104
+ *
105
+ * - `graphics.TEXTURE_FILTER_NEAREST_MIPMAP_LINEAR`
106
+ *
107
+ * - `graphics.TEXTURE_FILTER_LINEAR_MIPMAP_NEAREST`
108
+ *
109
+ * - `graphics.TEXTURE_FILTER_LINEAR_MIPMAP_LINEAR`
110
+ *
111
+ * `mag_filter`
112
+ * number the mag filter mode of the texture sampler
113
+ *
114
+ * - `graphics.TEXTURE_FILTER_DEFAULT`
115
+ *
116
+ * - `graphics.TEXTURE_FILTER_NEAREST`
117
+ *
118
+ * - `graphics.TEXTURE_FILTER_LINEAR`
119
+ *
120
+ * `max_anisotropy`
121
+ * number the max anisotropy of the texture sampler
122
+ * @example
123
+ * ```ts
124
+ * const samplers = material.get_samplers(resource.material("/my_material.materialc"));
125
+ * ```
126
+ */
127
+ function get_samplers(path: Hash | string): { name: Hash; u_wrap: number; v_wrap: number; min_filter: number; mag_filter: number; max_anisotropy: number }[];
128
+ /**
129
+ * Returns a table of all the textures from the material.
130
+ *
131
+ * @param path - The path to the resource
132
+ * @returns A table of tables, where each entry contains info about the material textures:
133
+ *
134
+ * `path`
135
+ * hash the resource path of the texture. Only available if the texture is a resource.
136
+ * `handle`
137
+ * hash the runtime handle of the texture.
138
+ * `width`
139
+ * number the width of the texture
140
+ * `height`
141
+ * number the height of the texture
142
+ * `depth`
143
+ * number the depth of the texture. Corresponds to the number of layers in an array texture.
144
+ * `mipmaps`
145
+ * number the number of mipmaps in the texture
146
+ * `type`
147
+ * number the type of the texture. Supported values:
148
+ *
149
+ * - `graphics.TEXTURE_TYPE_2D`
150
+ *
151
+ * - `graphics.TEXTURE_TYPE_2D_ARRAY`
152
+ *
153
+ * - `graphics.TEXTURE_TYPE_CUBE_MAP`
154
+ *
155
+ * - `graphics.TEXTURE_TYPE_IMAGE_2D`
156
+ *
157
+ * - `graphics.TEXTURE_TYPE_3D`
158
+ *
159
+ * - `graphics.TEXTURE_TYPE_IMAGE_3D`
160
+ *
161
+ * `flags`
162
+ * number the flags of the texture. This field is a bit mask of these supported flags:
163
+ *
164
+ * - `graphics.TEXTURE_USAGE_FLAG_SAMPLE`
165
+ *
166
+ * - `graphics.TEXTURE_USAGE_FLAG_MEMORYLESS`
167
+ *
168
+ * - `graphics.TEXTURE_USAGE_FLAG_STORAGE`
169
+ *
170
+ * - `graphics.TEXTURE_USAGE_FLAG_INPUT`
171
+ *
172
+ * - `graphics.TEXTURE_USAGE_FLAG_COLOR`
173
+ * @example
174
+ * ```ts
175
+ * const textures = material.get_textures(resource.material("/my_material.materialc"));
176
+ * ```
177
+ */
178
+ function get_textures(path: Hash | string): { path: Hash; handle: Hash; width: number; height: number; depth: number; mipmaps: number; type: number; flags: number }[];
179
+ /**
180
+ * Returns a table of all the vertex attributes in the material. This function will return all the vertex attributes
181
+ * that are used in the vertex shader of the material.
182
+ *
183
+ * @param path - The path to the resource
184
+ * @returns A table of tables, where each entry contains info about the vertex attributes:
185
+ *
186
+ * `name`
187
+ * hash the hashed name of the vertex attribute
188
+ * `value`
189
+ * vmath.vector4 | vmath.vector3 | vmath.matrix4 | number | table the value of the vertex attribute. Matrix attributes that do not map to `vmath.matrix4` are returned as a table of numbers.
190
+ * `normalize`
191
+ * boolean whether the value is normalized when passed into the shader
192
+ * `data_type`
193
+ * number the data type of the vertex attribute. Supported values:
194
+ *
195
+ * - `graphics.DATA_TYPE_BYTE`
196
+ *
197
+ * - `graphics.DATA_TYPE_UNSIGNED_BYTE`
198
+ *
199
+ * - `graphics.DATA_TYPE_SHORT`
200
+ *
201
+ * - `graphics.DATA_TYPE_UNSIGNED_SHORT`
202
+ *
203
+ * - `graphics.DATA_TYPE_INT`
204
+ *
205
+ * - `graphics.DATA_TYPE_UNSIGNED_INT`
206
+ *
207
+ * - `graphics.DATA_TYPE_FLOAT`
208
+ *
209
+ * `coordinate_space`
210
+ * number the coordinate space of the vertex attribute. Supported values:
211
+ *
212
+ * - `graphics.COORDINATE_SPACE_WORLD`
213
+ *
214
+ * - `graphics.COORDINATE_SPACE_LOCAL`
215
+ *
216
+ * `semantic_type`
217
+ * number the semantic type of the vertex attribute. Supported values:
218
+ *
219
+ * - `graphics.SEMANTIC_TYPE_NONE`
220
+ *
221
+ * - `graphics.SEMANTIC_TYPE_POSITION`
222
+ *
223
+ * - `graphics.SEMANTIC_TYPE_TEXCOORD`
224
+ *
225
+ * - `graphics.SEMANTIC_TYPE_PAGE_INDEX`
226
+ *
227
+ * - `graphics.SEMANTIC_TYPE_COLOR`
228
+ *
229
+ * - `graphics.SEMANTIC_TYPE_NORMAL`
230
+ *
231
+ * - `graphics.SEMANTIC_TYPE_TANGENT`
232
+ *
233
+ * - `graphics.SEMANTIC_TYPE_WORLD_MATRIX`
234
+ *
235
+ * - `graphics.SEMANTIC_TYPE_NORMAL_MATRIX`
236
+ *
237
+ * - `graphics.SEMANTIC_TYPE_BONE_WEIGHTS`
238
+ *
239
+ * - `graphics.SEMANTIC_TYPE_BONE_INDICES`
240
+ *
241
+ * - `graphics.SEMANTIC_TYPE_TEXTURE_TRANSFORM_2D`
242
+ * @example
243
+ * ```ts
244
+ * const vertex_attributes = material.get_vertex_attributes(resource.material("/my_material.materialc"));
245
+ * ```
246
+ */
247
+ function get_vertex_attributes(path: Hash | string): { name: Hash; value: Vector4 | Vector3 | Matrix4 | number | number[]; normalize: boolean; data_type: number; coordinate_space: number; semantic_type: number }[];
248
+ /**
249
+ * Sets shader constants in a material, if the constants exist.
250
+ *
251
+ * @param path - The path to the resource
252
+ * @param constants - A table keyed by constant name with args tables as values. Constants can be partially updated. Supported entries:
253
+ *
254
+ * `type`
255
+ * number the type of the constant. Supported values:
256
+ *
257
+ * - `material.CONSTANT_TYPE_USER`
258
+ *
259
+ * - `material.CONSTANT_TYPE_USER_MATRIX4`
260
+ *
261
+ * - `material.CONSTANT_TYPE_VIEWPROJ`
262
+ *
263
+ * - `material.CONSTANT_TYPE_WORLD`
264
+ *
265
+ * - `material.CONSTANT_TYPE_TEXTURE`
266
+ *
267
+ * - `material.CONSTANT_TYPE_VIEW`
268
+ *
269
+ * - `material.CONSTANT_TYPE_PROJECTION`
270
+ *
271
+ * - `material.CONSTANT_TYPE_NORMAL`
272
+ *
273
+ * - `material.CONSTANT_TYPE_WORLDVIEW`
274
+ *
275
+ * - `material.CONSTANT_TYPE_WORLDVIEWPROJ`
276
+ *
277
+ * - `material.CONSTANT_TYPE_TIME`
278
+ *
279
+ * - `material.CONSTANT_TYPE_WORLD_INVERSE`
280
+ *
281
+ * - `material.CONSTANT_TYPE_VIEW_INVERSE`
282
+ *
283
+ * - `material.CONSTANT_TYPE_PROJECTION_INVERSE`
284
+ *
285
+ * - `material.CONSTANT_TYPE_VIEWPROJ_INVERSE`
286
+ *
287
+ * - `material.CONSTANT_TYPE_WORLDVIEW_INVERSE`
288
+ *
289
+ * - `material.CONSTANT_TYPE_WORLDVIEWPROJ_INVERSE`
290
+ *
291
+ * `value`
292
+ * vmath.vector4 | vmath.vector3 | vmath.matrix4 | number | table the value(s) of the constant. If the shader constant is an array, the amount of values to update depends on how many values that are passed in the 'value' field.
293
+ * @example
294
+ * ```ts
295
+ * material.set_constants(resource.material("/my_material.materialc"), { tint: { value: vmath.vector4(1, 0, 0, 1) } });
296
+ * ```
297
+ */
298
+ function set_constants(path: Hash | string, constants: Record<string, { type?: number; value?: Vector4 | Vector3 | Matrix4 | number | (Vector4 | Matrix4)[] }>): void;
299
+ /**
300
+ * Sets texture samplers in a material, if the samplers exist. Use this function to change the settings of texture samplers.
301
+ * To set actual textures that should be bound to the samplers, use the `material.set_textures` function instead.
302
+ *
303
+ * @param path - The path to the resource
304
+ * @param samplers - A table keyed by sampler name with args tables as values. Partial updates are supported. Supported entries:
305
+ *
306
+ * `u_wrap`
307
+ * number the u wrap mode of the texture sampler. Supported values:
308
+ *
309
+ * - `graphics.TEXTURE_WRAP_CLAMP_TO_BORDER`
310
+ *
311
+ * - `graphics.TEXTURE_WRAP_CLAMP_TO_EDGE`
312
+ *
313
+ * - `graphics.TEXTURE_WRAP_MIRRORED_REPEAT`
314
+ *
315
+ * - `graphics.TEXTURE_WRAP_REPEAT`
316
+ *
317
+ * `v_wrap`
318
+ * number the v wrap mode of the texture sampler. Supported values:
319
+ *
320
+ * - `graphics.TEXTURE_WRAP_CLAMP_TO_BORDER`
321
+ *
322
+ * - `graphics.TEXTURE_WRAP_CLAMP_TO_EDGE`
323
+ *
324
+ * - `graphics.TEXTURE_WRAP_MIRRORED_REPEAT`
325
+ *
326
+ * - `graphics.TEXTURE_WRAP_REPEAT`
327
+ *
328
+ * `min_filter`
329
+ * number the min filter mode of the texture sampler. Supported values:
330
+ *
331
+ * - `graphics.TEXTURE_FILTER_DEFAULT`
332
+ *
333
+ * - `graphics.TEXTURE_FILTER_NEAREST`
334
+ *
335
+ * - `graphics.TEXTURE_FILTER_LINEAR`
336
+ *
337
+ * - `graphics.TEXTURE_FILTER_NEAREST_MIPMAP_NEAREST`
338
+ *
339
+ * - `graphics.TEXTURE_FILTER_NEAREST_MIPMAP_LINEAR`
340
+ *
341
+ * - `graphics.TEXTURE_FILTER_LINEAR_MIPMAP_NEAREST`
342
+ *
343
+ * - `graphics.TEXTURE_FILTER_LINEAR_MIPMAP_LINEAR`
344
+ *
345
+ * `mag_filter`
346
+ * number the mag filter mode of the texture sampler
347
+ *
348
+ * - `graphics.TEXTURE_FILTER_DEFAULT`
349
+ *
350
+ * - `graphics.TEXTURE_FILTER_NEAREST`
351
+ *
352
+ * - `graphics.TEXTURE_FILTER_LINEAR`
353
+ *
354
+ * `max_anisotropy`
355
+ * number the max anisotropy of the texture sampler
356
+ * @example
357
+ * ```ts
358
+ * material.set_samplers(resource.material("/my_material.materialc"), { texture_sampler: { u_wrap: graphics.TEXTURE_WRAP_REPEAT, v_wrap: graphics.TEXTURE_WRAP_MIRRORED_REPEAT } });
359
+ * ```
360
+ */
361
+ function set_samplers(path: Hash | string, samplers: Record<string, { u_wrap?: number; v_wrap?: number; min_filter?: number; mag_filter?: number; max_anisotropy?: number }>): void;
362
+ /**
363
+ * Sets textures in a material, if the samplers exist.
364
+ *
365
+ * @param path - The path to the resource
366
+ * @param textures - A table keyed by sampler name with texture resources as values.
367
+ * @example
368
+ * ```ts
369
+ * material.set_textures(resource.material("/my_material.materialc"), { my_texture: resource.texture() });
370
+ * ```
371
+ */
372
+ function set_textures(path: Hash | string, textures: LuaMap<string, Hash>): void;
373
+ /**
374
+ * Sets vertex attributes in a material, if the vertex attributes exist.
375
+ *
376
+ * @param path - The path to the resource
377
+ * @param attributes - A table keyed by vertex attribute name with args tables as values. Partial updates are supported. Supported entries:
378
+ *
379
+ * `value`
380
+ * vmath.vector4 | vmath.vector3 | vmath.matrix4 | number | table the value of the vertex attribute. Use a table of numbers for matrix attributes that do not map to `vmath.matrix4`.
381
+ * `normalize`
382
+ * boolean whether the value is normalized when passed into the shader
383
+ * `data_type`
384
+ * number the data type of the vertex attribute. Supported values:
385
+ *
386
+ * - `graphics.DATA_TYPE_BYTE`
387
+ *
388
+ * - `graphics.DATA_TYPE_UNSIGNED_BYTE`
389
+ *
390
+ * - `graphics.DATA_TYPE_SHORT`
391
+ *
392
+ * - `graphics.DATA_TYPE_UNSIGNED_SHORT`
393
+ *
394
+ * - `graphics.DATA_TYPE_INT`
395
+ *
396
+ * - `graphics.DATA_TYPE_UNSIGNED_INT`
397
+ *
398
+ * - `graphics.DATA_TYPE_FLOAT`
399
+ *
400
+ * `coordinate_space`
401
+ * number the coordinate space of the vertex attribute. Supported values:
402
+ *
403
+ * - `graphics.COORDINATE_SPACE_DEFAULT`
404
+ *
405
+ * - `graphics.COORDINATE_SPACE_WORLD`
406
+ *
407
+ * - `graphics.COORDINATE_SPACE_LOCAL`
408
+ *
409
+ * `semantic_type`
410
+ * number the semantic type of the vertex attribute. Supported values:
411
+ *
412
+ * - `graphics.SEMANTIC_TYPE_NONE`
413
+ *
414
+ * - `graphics.SEMANTIC_TYPE_POSITION`
415
+ *
416
+ * - `graphics.SEMANTIC_TYPE_TEXCOORD`
417
+ *
418
+ * - `graphics.SEMANTIC_TYPE_PAGE_INDEX`
419
+ *
420
+ * - `graphics.SEMANTIC_TYPE_COLOR`
421
+ *
422
+ * - `graphics.SEMANTIC_TYPE_NORMAL`
423
+ *
424
+ * - `graphics.SEMANTIC_TYPE_TANGENT`
425
+ *
426
+ * - `graphics.SEMANTIC_TYPE_WORLD_MATRIX`
427
+ *
428
+ * - `graphics.SEMANTIC_TYPE_NORMAL_MATRIX`
429
+ *
430
+ * - `graphics.SEMANTIC_TYPE_BONE_WEIGHTS`
431
+ *
432
+ * - `graphics.SEMANTIC_TYPE_BONE_INDICES`
433
+ *
434
+ * - `graphics.SEMANTIC_TYPE_TEXTURE_TRANSFORM_2D`
435
+ * @example
436
+ * ```ts
437
+ * material.set_vertex_attributes(resource.material("/my_material.materialc"), { tint_attribute: { value: vmath.vector4(1, 0, 0, 1), semantic_type: graphics.SEMANTIC_TYPE_COLOR } });
438
+ * ```
439
+ */
440
+ function set_vertex_attributes(path: Hash | string, attributes: Record<string, { value?: Vector4 | Vector3 | Matrix4 | number | number[]; normalize?: boolean; data_type?: number; coordinate_space?: number; semantic_type?: number }>): void;
441
+ }
442
+ }
443
+
444
+ export {};
@@ -3,7 +3,7 @@ import type { Hash, Opaque, Url, Vector3 } from "../src/core-types";
3
3
 
4
4
  declare global {
5
5
  /**
6
- * Functions and messages for interacting with model components.
6
+ * Model API documentation
7
7
  */
8
8
  namespace model {
9
9
  /**
@@ -25,6 +25,21 @@ declare global {
25
25
  * ```
26
26
  */
27
27
  function get_aabb(url: string | Hash | Url): { min: Vector3; max: Vector3 };
28
+ /**
29
+ * Returns a table of numbers with one entry per morph target on the first mesh of the model that has morph targets.
30
+ * Values reflect the rig state at call time (after animation, and any active script override from model.set_blend_weights).
31
+ *
32
+ * @param url - the model component
33
+ * @returns array of weight values, or empty table if the model has no morph targets
34
+ * @example
35
+ * ```ts
36
+ * const weights = model.get_blend_weights("#model");
37
+ * weights[1] = 0.75;
38
+ * weights[2] = 0.25;
39
+ * model.set_blend_weights("#model", weights);
40
+ * ```
41
+ */
42
+ function get_blend_weights(url: string | Hash | Url): number[];
28
43
  /**
29
44
  * Gets the id of the game object that corresponds to a model skeleton bone.
30
45
  * The returned game object can be used for parenting and transform queries.
@@ -159,6 +174,36 @@ declare global {
159
174
  * ```
160
175
  */
161
176
  function play_anim(url: string | Hash | Url, anim_id: string | Hash, playback: Opaque<"constant">, play_properties?: { blend_duration?: number; offset?: number; playback_rate?: number }, complete_function?: (self: unknown, message_id: unknown, message: unknown, sender: unknown) => void): void;
177
+ /**
178
+ * Resets a shader constant for a model component.
179
+ * The constant must be defined in the material assigned to the model.
180
+ * Resetting a constant through this function implies that the value defined in the material will be used.
181
+ * Which model to reset a constant for is identified by the URL.
182
+ *
183
+ * @param url - the model that should have a constant reset.
184
+ * @param constant - name of the constant.
185
+ * @example
186
+ * ```ts
187
+ * model.reset_constant("#model", "tint");
188
+ * ```
189
+ */
190
+ function reset_constant(url: string | Hash | Url, constant: string | Hash): void;
191
+ /**
192
+ * Copies numeric values from `weights` into each morph target slot for every mesh on the model that has morph targets.
193
+ * At most as many weights are applied as each mesh has morph targets; extra entries in the table are ignored.
194
+ * Missing weights leave the tail zero-filled for meshes with more targets than entries.
195
+ * The override is re-applied every frame after animations run, until cleared by omitting `weights` or passing `nil`.
196
+ * To reset the weights, use `model.set_blend_weights(url)` or `model.set_blend_weights(url, nil)`.
197
+ *
198
+ * @param url - the model component
199
+ * @param weights - array of weight values (1-based indices). Omit or pass `nil` to clear the override and return morphs to animation only
200
+ * @example
201
+ * ```ts
202
+ * model.set_blend_weights("#model", [0, 1, 0.5, 0]);
203
+ * model.set_blend_weights("#model");
204
+ * ```
205
+ */
206
+ function set_blend_weights(url: string | Hash | Url, weights?: number[]): void;
162
207
  /**
163
208
  * Enable or disable visibility of a mesh
164
209
  *
@@ -186,10 +231,6 @@ declare global {
186
231
  * Please note that model events may not fire as expected when the cursor is manipulated directly.
187
232
  */
188
233
  cursor: number;
189
- /**
190
- * The material used when rendering the model. The type of the property is hash.
191
- */
192
- material: Hash;
193
234
  /**
194
235
  * The animation playback rate. A multiplier to the animation playback rate. The type of the property is number.
195
236
  */
@@ -3,9 +3,7 @@ import type { Hash, Url, Vector3 } from "../src/core-types";
3
3
 
4
4
  declare global {
5
5
  /**
6
- * Functions and messages for collision object physics interaction
7
- * with other objects (collisions and ray-casting) and control of
8
- * physical behaviors.
6
+ * Collision object physics API documentation
9
7
  */
10
8
  namespace physics {
11
9
  /**
@@ -79,8 +79,7 @@ declare global {
79
79
  */
80
80
  function get_cpu_usage(): number;
81
81
  /**
82
- * Get the amount of memory used (resident/working set) by the application in bytes, as reported by the OS.
83
- * This function is not available on HTML5.
82
+ * Get the detailed amount of memory used by the application in bytes, as reported by the platform.
84
83
  * The values are gathered from internal OS functions which correspond to the following;
85
84
  *
86
85
  * OS
@@ -97,7 +96,7 @@ declare global {
97
96
  * Working set
98
97
  *
99
98
  * HTML5
100
- * Not available
99
+ * Allocated bytes reported by `mallinfo().uordblks`
101
100
  *
102
101
  * @returns used by the application
103
102
  * @example