@defold-typescript/types 0.19.4 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api-availability.json +2755 -0
- package/api-migrations.json +31 -0
- package/api-signatures.json +2324 -0
- package/api-targets.json +493 -45
- package/generated/b2d.d.ts +6 -0
- package/generated/b2d_body.d.ts +329 -1
- package/generated/b2d_chain.d.ts +106 -0
- package/generated/b2d_fixture.d.ts +155 -0
- package/generated/b2d_joint.d.ts +823 -0
- package/generated/b2d_shape.d.ts +215 -0
- package/generated/b2d_world.d.ts +314 -0
- package/generated/buffer.d.ts +1 -1
- package/generated/builtin-messages.d.ts +18 -0
- package/generated/camera.d.ts +62 -5
- package/generated/compute.d.ts +306 -0
- package/generated/crash.d.ts +2 -2
- package/generated/go.d.ts +31 -6
- package/generated/graphics.d.ts +95 -0
- package/generated/gui.d.ts +4 -6
- package/generated/image.d.ts +3 -3
- package/generated/json.d.ts +2 -2
- package/generated/kinds/gui-script.d.ts +7 -0
- package/generated/kinds/render-script.d.ts +7 -0
- package/generated/kinds/script.d.ts +7 -0
- package/generated/label.d.ts +1 -1
- package/generated/liveupdate.d.ts +22 -4
- package/generated/material.d.ts +444 -0
- package/generated/model.d.ts +46 -5
- package/generated/physics.d.ts +2 -4
- package/generated/profiler.d.ts +2 -3
- package/generated/render.d.ts +25 -9
- package/generated/resource.d.ts +2 -2
- package/generated/socket.d.ts +35 -35
- package/generated/sprite.d.ts +15 -1
- package/generated/sys.d.ts +1 -1
- package/generated/tilemap.d.ts +14 -0
- package/generated/timer.d.ts +1 -1
- package/generated/versions/defold-1.12.4/b2d.d.ts +27 -0
- package/generated/versions/defold-1.12.4/b2d_body.d.ts +348 -0
- package/generated/versions/defold-1.12.4/buffer.d.ts +176 -0
- package/generated/versions/defold-1.12.4/camera.d.ts +245 -0
- package/generated/versions/defold-1.12.4/collectionfactory.d.ts +146 -0
- package/generated/versions/defold-1.12.4/collectionproxy.d.ts +71 -0
- package/generated/versions/defold-1.12.4/crash.d.ts +143 -0
- package/generated/versions/defold-1.12.4/factory.d.ts +123 -0
- package/generated/versions/defold-1.12.4/font.d.ts +81 -0
- package/generated/versions/defold-1.12.4/go.d.ts +1029 -0
- package/generated/versions/defold-1.12.4/graphics.d.ts +226 -0
- package/generated/versions/defold-1.12.4/gui.d.ts +2372 -0
- package/generated/versions/defold-1.12.4/html5.d.ts +53 -0
- package/generated/versions/defold-1.12.4/http.d.ts +84 -0
- package/generated/versions/defold-1.12.4/iac.d.ts +18 -0
- package/generated/versions/defold-1.12.4/iap.d.ts +60 -0
- package/generated/versions/defold-1.12.4/image.d.ts +139 -0
- package/generated/versions/defold-1.12.4/index.d.ts +41 -0
- package/generated/versions/defold-1.12.4/json.d.ts +76 -0
- package/generated/versions/defold-1.12.4/label.d.ts +94 -0
- package/generated/versions/defold-1.12.4/liveupdate.d.ts +122 -0
- package/generated/versions/defold-1.12.4/model.d.ts +205 -0
- package/generated/versions/defold-1.12.4/msg.d.ts +10 -0
- package/generated/versions/defold-1.12.4/particlefx.d.ts +166 -0
- package/generated/versions/defold-1.12.4/physics.d.ts +547 -0
- package/generated/versions/defold-1.12.4/profiler.d.ts +234 -0
- package/generated/versions/defold-1.12.4/push.d.ts +66 -0
- package/generated/versions/defold-1.12.4/render.d.ts +1149 -0
- package/generated/versions/defold-1.12.4/resource.d.ts +1518 -0
- package/generated/versions/defold-1.12.4/socket.d.ts +795 -0
- package/generated/versions/defold-1.12.4/sound.d.ts +291 -0
- package/generated/versions/defold-1.12.4/sprite.d.ts +143 -0
- package/generated/versions/defold-1.12.4/sys.d.ts +695 -0
- package/generated/versions/defold-1.12.4/tilemap.d.ts +181 -0
- package/generated/versions/defold-1.12.4/timer.d.ts +114 -0
- package/generated/versions/defold-1.12.4/types.d.ts +61 -0
- package/generated/versions/defold-1.12.4/vmath.d.ts +806 -0
- package/generated/versions/defold-1.12.4/webview.d.ts +68 -0
- package/generated/versions/defold-1.12.4/window.d.ts +198 -0
- package/generated/versions/defold-1.12.4/zlib.d.ts +40 -0
- package/index.d.ts +22 -0
- package/package.json +8 -1
- package/scripts/fidelity-audit.ts +69 -12
- package/scripts/fidelity-baseline.json +56 -0
- package/scripts/generate-api-availability.ts +139 -0
- package/scripts/generate-api-signatures.ts +66 -0
- package/scripts/import-defold-release.ts +480 -0
- package/scripts/materialize-version.ts +45 -20
- package/scripts/regen.ts +53 -6
- package/scripts/sync-api-docs.ts +89 -41
- package/src/api-availability.ts +0 -0
- package/src/core-types.ts +9 -0
- package/src/emit-dts.ts +685 -17
- package/src/emit-messages.ts +72 -2
- package/src/index.ts +26 -1
- package/src/lifecycle.ts +43 -2
package/generated/image.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ declare global {
|
|
|
47
47
|
* pprint(s);
|
|
48
48
|
* ```
|
|
49
49
|
*/
|
|
50
|
-
function get_astc_header(buffer: string): { width: number; height: number; depth: number; block_size_x: number; block_size_y: number; block_size_z: number } |
|
|
50
|
+
function get_astc_header(buffer: string): { width: number; height: number; depth: number; block_size_x: number; block_size_y: number; block_size_z: number } | undefined;
|
|
51
51
|
/**
|
|
52
52
|
* Load image (PNG or JPEG) from buffer.
|
|
53
53
|
*
|
|
@@ -85,7 +85,7 @@ declare global {
|
|
|
85
85
|
* });
|
|
86
86
|
* ```
|
|
87
87
|
*/
|
|
88
|
-
function load(buffer: string, options?: { premultiply_alpha?: boolean; flip_vertically?: boolean }): { width: number; height: number; type: Opaque<"constant">; buffer: string } |
|
|
88
|
+
function load(buffer: string, options?: { premultiply_alpha?: boolean; flip_vertically?: boolean }): { width: number; height: number; type: Opaque<"constant">; buffer: string } | undefined;
|
|
89
89
|
/**
|
|
90
90
|
* Load image (PNG or JPEG) from a string buffer.
|
|
91
91
|
*
|
|
@@ -132,7 +132,7 @@ declare global {
|
|
|
132
132
|
* });
|
|
133
133
|
* ```
|
|
134
134
|
*/
|
|
135
|
-
function load_buffer(buffer: string, options?: { premultiply_alpha?: boolean; flip_vertically?: boolean }): { width: number; height: number; type: Opaque<"constant">; buffer: Opaque<"buffer"> } |
|
|
135
|
+
function load_buffer(buffer: string, options?: { premultiply_alpha?: boolean; flip_vertically?: boolean }): { width: number; height: number; type: Opaque<"constant">; buffer: Opaque<"buffer"> } | undefined;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
package/generated/json.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ declare global {
|
|
|
15
15
|
* @param json - json data
|
|
16
16
|
* @param options - table with decode options
|
|
17
17
|
*
|
|
18
|
-
* - boolean `decode_null_as_userdata`:
|
|
18
|
+
* - boolean `decode_null_as_userdata`: whether to decode a JSON null value as json.null or nil (default is nil)
|
|
19
19
|
* @returns decoded json
|
|
20
20
|
* @example
|
|
21
21
|
* ```ts
|
|
@@ -49,7 +49,7 @@ declare global {
|
|
|
49
49
|
* @param tbl - lua table to encode
|
|
50
50
|
* @param options - table with encode options
|
|
51
51
|
*
|
|
52
|
-
* - string `encode_empty_table_as_object`:
|
|
52
|
+
* - string `encode_empty_table_as_object`: whether to encode an empty table as an JSON object or array (default is object)
|
|
53
53
|
* @returns encoded json
|
|
54
54
|
* @example
|
|
55
55
|
* ```ts
|
|
@@ -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";
|
|
@@ -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";
|
|
@@ -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";
|
package/generated/label.d.ts
CHANGED
|
@@ -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: (
|
|
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 {};
|