@defold-typescript/types 0.49.0 → 0.50.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 +696 -624
- package/api-signatures.json +6799 -160
- package/api-targets.json +393 -2
- package/examples/translations.json +12 -0
- package/generated/b2d.d.ts +15 -0
- package/generated/bullet3d.d.ts +16 -0
- package/generated/font.d.ts +7 -3
- package/generated/graphics.d.ts +7 -0
- package/generated/gui.d.ts +5 -4
- package/generated/label.d.ts +3 -3
- package/generated/render.d.ts +16 -1
- package/generated/versions/defold-1.13.2/b2d.d.ts +709 -0
- package/generated/versions/defold-1.13.2/b2d_body.d.ts +593 -0
- package/generated/versions/defold-1.13.2/b2d_chain.d.ts +105 -0
- package/generated/versions/defold-1.13.2/b2d_fixture.d.ts +175 -0
- package/generated/versions/defold-1.13.2/b2d_joint.d.ts +1301 -0
- package/generated/versions/defold-1.13.2/b2d_shape.d.ts +423 -0
- package/generated/versions/defold-1.13.2/b2d_world.d.ts +308 -0
- package/generated/versions/defold-1.13.2/buffer.d.ts +192 -0
- package/generated/versions/defold-1.13.2/bullet3d.d.ts +91 -0
- package/generated/versions/defold-1.13.2/bullet3d_collision_object.d.ts +433 -0
- package/generated/versions/defold-1.13.2/bullet3d_constraint.d.ts +818 -0
- package/generated/versions/defold-1.13.2/bullet3d_rigid_body.d.ts +429 -0
- package/generated/versions/defold-1.13.2/bullet3d_shape.d.ts +123 -0
- package/generated/versions/defold-1.13.2/bullet3d_world.d.ts +492 -0
- package/generated/versions/defold-1.13.2/camera.d.ts +300 -0
- package/generated/versions/defold-1.13.2/collectionfactory.d.ts +148 -0
- package/generated/versions/defold-1.13.2/collectionproxy.d.ts +109 -0
- package/generated/versions/defold-1.13.2/compute.d.ts +107 -0
- package/generated/versions/defold-1.13.2/crash.d.ts +157 -0
- package/generated/versions/defold-1.13.2/editor-vm/http.d.ts +139 -0
- package/generated/versions/defold-1.13.2/editor-vm/image.d.ts +48 -0
- package/generated/versions/defold-1.13.2/editor-vm/json.d.ts +21 -0
- package/generated/versions/defold-1.13.2/editor-vm/localization.d.ts +42 -0
- package/generated/versions/defold-1.13.2/editor-vm/tilemap_tiles.d.ts +126 -0
- package/generated/versions/defold-1.13.2/editor-vm/zip.d.ts +38 -0
- package/generated/versions/defold-1.13.2/editor-vm/zlib.d.ts +24 -0
- package/generated/versions/defold-1.13.2/editor.d.ts +2177 -0
- package/generated/versions/defold-1.13.2/factory.d.ts +121 -0
- package/generated/versions/defold-1.13.2/font.d.ts +123 -0
- package/generated/versions/defold-1.13.2/go.d.ts +1166 -0
- package/generated/versions/defold-1.13.2/graphics.d.ts +613 -0
- package/generated/versions/defold-1.13.2/gui.d.ts +2212 -0
- package/generated/versions/defold-1.13.2/html5.d.ts +55 -0
- package/generated/versions/defold-1.13.2/http.d.ts +83 -0
- package/generated/versions/defold-1.13.2/image.d.ts +181 -0
- package/generated/versions/defold-1.13.2/index.d.ts +63 -0
- package/generated/versions/defold-1.13.2/json.d.ts +94 -0
- package/generated/versions/defold-1.13.2/kinds/editor-script.d.ts +14 -0
- package/generated/versions/defold-1.13.2/label.d.ts +164 -0
- package/generated/versions/defold-1.13.2/liveupdate.d.ts +143 -0
- package/generated/versions/defold-1.13.2/material.d.ts +490 -0
- package/generated/versions/defold-1.13.2/model.d.ts +287 -0
- package/generated/versions/defold-1.13.2/msg.d.ts +10 -0
- package/generated/versions/defold-1.13.2/particlefx.d.ts +155 -0
- package/generated/versions/defold-1.13.2/physics.d.ts +789 -0
- package/generated/versions/defold-1.13.2/profiler.d.ts +228 -0
- package/generated/versions/defold-1.13.2/render.d.ts +1153 -0
- package/generated/versions/defold-1.13.2/resource.d.ts +1628 -0
- package/generated/versions/defold-1.13.2/socket.d.ts +797 -0
- package/generated/versions/defold-1.13.2/sound.d.ts +323 -0
- package/generated/versions/defold-1.13.2/sprite.d.ts +179 -0
- package/generated/versions/defold-1.13.2/sys.d.ts +754 -0
- package/generated/versions/defold-1.13.2/tilemap.d.ts +206 -0
- package/generated/versions/defold-1.13.2/timer.d.ts +136 -0
- package/generated/versions/defold-1.13.2/types.d.ts +61 -0
- package/generated/versions/defold-1.13.2/vmath.d.ts +775 -0
- package/generated/versions/defold-1.13.2/window.d.ts +196 -0
- package/generated/versions/defold-1.13.2/zlib.d.ts +41 -0
- package/identity-vocabulary.json +1 -0
- package/package.json +2 -2
- package/scripts/import-defold-release.ts +3 -31
- package/scripts/materialize-version.ts +13 -7
- package/scripts/regen.ts +63 -29
- package/scripts/sync-api-docs.ts +31 -2
- package/src/emit-dts.ts +25 -3
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import type { Hash } from "../../../src/core-types";
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
/**
|
|
6
|
+
* Functions and constants to access resources.
|
|
7
|
+
*/
|
|
8
|
+
namespace liveupdate {
|
|
9
|
+
type LIVEUPDATE = typeof liveupdate.LIVEUPDATE_BUNDLED_RESOURCE_MISMATCH | typeof liveupdate.LIVEUPDATE_ENGINE_VERSION_MISMATCH | typeof liveupdate.LIVEUPDATE_FORMAT_ERROR | typeof liveupdate.LIVEUPDATE_INVAL | typeof liveupdate.LIVEUPDATE_INVALID_HEADER | typeof liveupdate.LIVEUPDATE_INVALID_RESOURCE | typeof liveupdate.LIVEUPDATE_IO_ERROR | typeof liveupdate.LIVEUPDATE_MEM_ERROR | typeof liveupdate.LIVEUPDATE_OK | typeof liveupdate.LIVEUPDATE_SCHEME_MISMATCH | typeof liveupdate.LIVEUPDATE_SIGNATURE_MISMATCH | typeof liveupdate.LIVEUPDATE_UNKNOWN | typeof liveupdate.LIVEUPDATE_VERSION_MISMATCH;
|
|
10
|
+
/**
|
|
11
|
+
* Mismatch between between expected bundled resources and actual bundled resources. The manifest expects a resource to be in the bundle, but it was not found in the bundle. This is typically the case when a non-excluded resource was modified between publishing the bundle and publishing the manifest.
|
|
12
|
+
*/
|
|
13
|
+
const LIVEUPDATE_BUNDLED_RESOURCE_MISMATCH: number & { readonly __brand: "liveupdate.LIVEUPDATE_BUNDLED_RESOURCE_MISMATCH" };
|
|
14
|
+
/**
|
|
15
|
+
* Mismatch between running engine version and engine versions supported by manifest.
|
|
16
|
+
*/
|
|
17
|
+
const LIVEUPDATE_ENGINE_VERSION_MISMATCH: number & { readonly __brand: "liveupdate.LIVEUPDATE_ENGINE_VERSION_MISMATCH" };
|
|
18
|
+
/**
|
|
19
|
+
* Failed to parse manifest data buffer. The manifest was probably produced by a different engine version.
|
|
20
|
+
*/
|
|
21
|
+
const LIVEUPDATE_FORMAT_ERROR: number & { readonly __brand: "liveupdate.LIVEUPDATE_FORMAT_ERROR" };
|
|
22
|
+
/**
|
|
23
|
+
* Argument was invalid
|
|
24
|
+
*/
|
|
25
|
+
const LIVEUPDATE_INVAL: number & { readonly __brand: "liveupdate.LIVEUPDATE_INVAL" };
|
|
26
|
+
/**
|
|
27
|
+
* The handled resource is invalid.
|
|
28
|
+
*/
|
|
29
|
+
const LIVEUPDATE_INVALID_HEADER: number & { readonly __brand: "liveupdate.LIVEUPDATE_INVALID_HEADER" };
|
|
30
|
+
/**
|
|
31
|
+
* The header of the resource is invalid.
|
|
32
|
+
*/
|
|
33
|
+
const LIVEUPDATE_INVALID_RESOURCE: number & { readonly __brand: "liveupdate.LIVEUPDATE_INVALID_RESOURCE" };
|
|
34
|
+
/**
|
|
35
|
+
* I/O operation failed
|
|
36
|
+
*/
|
|
37
|
+
const LIVEUPDATE_IO_ERROR: number & { readonly __brand: "liveupdate.LIVEUPDATE_IO_ERROR" };
|
|
38
|
+
/**
|
|
39
|
+
* Memory wasn't allocated
|
|
40
|
+
*/
|
|
41
|
+
const LIVEUPDATE_MEM_ERROR: number & { readonly __brand: "liveupdate.LIVEUPDATE_MEM_ERROR" };
|
|
42
|
+
/**
|
|
43
|
+
* Operation completed successfully.
|
|
44
|
+
*/
|
|
45
|
+
const LIVEUPDATE_OK: number & { readonly __brand: "liveupdate.LIVEUPDATE_OK" };
|
|
46
|
+
/**
|
|
47
|
+
* Mismatch between scheme used to load resources. Resources are loaded with a different scheme than from manifest, for example over HTTP or directly from file. This is typically the case when running the game directly from the editor instead of from a bundle.
|
|
48
|
+
*/
|
|
49
|
+
const LIVEUPDATE_SCHEME_MISMATCH: number & { readonly __brand: "liveupdate.LIVEUPDATE_SCHEME_MISMATCH" };
|
|
50
|
+
/**
|
|
51
|
+
* Mismatch between expected and actual integrity data for legacy liveupdate verification.
|
|
52
|
+
*/
|
|
53
|
+
const LIVEUPDATE_SIGNATURE_MISMATCH: number & { readonly __brand: "liveupdate.LIVEUPDATE_SIGNATURE_MISMATCH" };
|
|
54
|
+
/**
|
|
55
|
+
* Unspecified error
|
|
56
|
+
*/
|
|
57
|
+
const LIVEUPDATE_UNKNOWN: number & { readonly __brand: "liveupdate.LIVEUPDATE_UNKNOWN" };
|
|
58
|
+
/**
|
|
59
|
+
* Mismatch between manifest expected version and actual version.
|
|
60
|
+
*/
|
|
61
|
+
const LIVEUPDATE_VERSION_MISMATCH: number & { readonly __brand: "liveupdate.LIVEUPDATE_VERSION_MISMATCH" };
|
|
62
|
+
/**
|
|
63
|
+
* Adds a resource mount to the resource system.
|
|
64
|
+
* After the mount succeeded, the resources are available to load. (i.e. no reboot required)
|
|
65
|
+
*
|
|
66
|
+
* @param name - Unique name of the mount
|
|
67
|
+
* @param uri - The uri of the mount, including the scheme. Currently supported schemes are 'zip' and 'archive'.
|
|
68
|
+
* @param priority - Priority of mount. Larger priority takes prescedence
|
|
69
|
+
* @param callback - Callback after the asynchronous request completed
|
|
70
|
+
* - `name` hash Unique name of the mount
|
|
71
|
+
* - `uri` string The uri of the mount
|
|
72
|
+
* - `result` liveupdate.LIVEUPDATE The result of the request
|
|
73
|
+
* @returns The result of the request
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* // Add multiple mounts. Higher priority takes precedence.
|
|
77
|
+
* liveupdate.add_mount("common", "zip:/path/to/common_stuff.zip", 10, (result) => {}); // base pack
|
|
78
|
+
* liveupdate.add_mount("levelpack_1", "zip:/path/to/levels_1_to_20.zip", 20, (result) => {}); // level pack
|
|
79
|
+
* liveupdate.add_mount("season_pack_1", "zip:/path/to/easter_pack_1.zip", 30, (result) => {}); // season pack, overriding content in the other packs
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
function add_mount(name: string | Hash, uri: string, priority: number, callback: (self: unknown, name: Hash, uri: string, result: liveupdate.LIVEUPDATE) => void): liveupdate.LIVEUPDATE;
|
|
83
|
+
/**
|
|
84
|
+
* Get an array of the current mounts
|
|
85
|
+
* This can be used to determine if a new mount is needed or not
|
|
86
|
+
*
|
|
87
|
+
* @returns Array of mounts
|
|
88
|
+
* @example
|
|
89
|
+
* Output the current resource mounts
|
|
90
|
+
* ```ts
|
|
91
|
+
* pprint("MOUNTS", liveupdate.get_mounts());
|
|
92
|
+
* ```
|
|
93
|
+
* @example
|
|
94
|
+
* Give an output like:
|
|
95
|
+
* ```ts
|
|
96
|
+
* // DEBUG:SCRIPT: MOUNTS,
|
|
97
|
+
* // {
|
|
98
|
+
* // 1 = {
|
|
99
|
+
* // name = hash: [liveupdate],
|
|
100
|
+
* // uri = "zip:/device/path/to/acchives/liveupdate.zip",
|
|
101
|
+
* // priority = 5
|
|
102
|
+
* // },
|
|
103
|
+
* // 2 = {
|
|
104
|
+
* // name = hash: [_base],
|
|
105
|
+
* // uri = "archive:build/default/game.dmanifest",
|
|
106
|
+
* // priority = -10
|
|
107
|
+
* // }
|
|
108
|
+
* // }
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
function get_mounts(): ({ name: Hash; uri: string; priority: number })[];
|
|
112
|
+
/**
|
|
113
|
+
* Checks if the bundled application was built with one or more resources
|
|
114
|
+
* excluded from the main bundle, through a collection proxy with
|
|
115
|
+
* `Exclude` enabled.
|
|
116
|
+
* This value is based on metadata in the bundled manifest. It does not check
|
|
117
|
+
* whether any live update archive has been mounted or whether the excluded
|
|
118
|
+
* resources are currently available on device.
|
|
119
|
+
*
|
|
120
|
+
* @returns true if the bundled application was built with excluded files
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* if (liveupdate.is_built_with_excluded_files()) print("The bundle expects live update content.");
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
function is_built_with_excluded_files(): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Remove a mount the resource system.
|
|
129
|
+
* Removing a mount does not affect any loaded resources.
|
|
130
|
+
*
|
|
131
|
+
* @param name - Unique name of the mount
|
|
132
|
+
* @returns The result of the call
|
|
133
|
+
* @example
|
|
134
|
+
* ```ts
|
|
135
|
+
* // Add multiple mounts. Higher priority takes precedence.
|
|
136
|
+
* liveupdate.remove_mount("season_pack_1");
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
function remove_mount(name: string | Hash): liveupdate.LIVEUPDATE;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export {};
|
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import type { Hash, Matrix4, Opaque, Vector3, Vector4 } from "../../../src/core-types";
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
/**
|
|
6
|
+
* Functions for interacting with materials.
|
|
7
|
+
*/
|
|
8
|
+
namespace material {
|
|
9
|
+
/**
|
|
10
|
+
* Shader constant information
|
|
11
|
+
*/
|
|
12
|
+
interface constant_info {
|
|
13
|
+
/**
|
|
14
|
+
* Constant name.
|
|
15
|
+
*/
|
|
16
|
+
name: Hash;
|
|
17
|
+
/**
|
|
18
|
+
* Constant type.
|
|
19
|
+
*/
|
|
20
|
+
type: material.CONSTANT_TYPE;
|
|
21
|
+
/**
|
|
22
|
+
* Constant value or values. Present for user constants.
|
|
23
|
+
*/
|
|
24
|
+
value?: material.constant_info_value;
|
|
25
|
+
}
|
|
26
|
+
type constant_info_value = Vector4 | Matrix4 | Vector4[] | Matrix4[];
|
|
27
|
+
/**
|
|
28
|
+
* Shader constant update
|
|
29
|
+
*/
|
|
30
|
+
interface constant_options {
|
|
31
|
+
/**
|
|
32
|
+
* Constant type.
|
|
33
|
+
*/
|
|
34
|
+
type?: material.CONSTANT_TYPE;
|
|
35
|
+
/**
|
|
36
|
+
* Constant value or values.
|
|
37
|
+
*/
|
|
38
|
+
value?: material.constant_value;
|
|
39
|
+
}
|
|
40
|
+
type constant_value = number | Vector3 | Vector4 | Matrix4 | (number | Vector3 | Vector4 | Matrix4)[];
|
|
41
|
+
/**
|
|
42
|
+
* Named material vertex attribute update
|
|
43
|
+
*/
|
|
44
|
+
interface named_vertex_attribute_options {
|
|
45
|
+
/**
|
|
46
|
+
* Attribute name.
|
|
47
|
+
*/
|
|
48
|
+
name: string | Hash;
|
|
49
|
+
/**
|
|
50
|
+
* Attribute value.
|
|
51
|
+
*/
|
|
52
|
+
value?: material.vertex_attribute_value;
|
|
53
|
+
/**
|
|
54
|
+
* Whether integer data is normalized.
|
|
55
|
+
*/
|
|
56
|
+
normalize?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Attribute data type.
|
|
59
|
+
*/
|
|
60
|
+
data_type?: graphics.DATA_TYPE;
|
|
61
|
+
/**
|
|
62
|
+
* Attribute coordinate space.
|
|
63
|
+
*/
|
|
64
|
+
coordinate_space?: graphics.COORDINATE_SPACE;
|
|
65
|
+
/**
|
|
66
|
+
* Attribute semantic.
|
|
67
|
+
*/
|
|
68
|
+
semantic_type?: graphics.SEMANTIC_TYPE;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Texture sampler information
|
|
72
|
+
*/
|
|
73
|
+
interface sampler_info {
|
|
74
|
+
/**
|
|
75
|
+
* Sampler name.
|
|
76
|
+
*/
|
|
77
|
+
name: Hash;
|
|
78
|
+
/**
|
|
79
|
+
* Sampler texture type.
|
|
80
|
+
*/
|
|
81
|
+
type: graphics.TEXTURE_TYPE;
|
|
82
|
+
/**
|
|
83
|
+
* Horizontal wrap mode.
|
|
84
|
+
*/
|
|
85
|
+
u_wrap: graphics.TEXTURE_WRAP;
|
|
86
|
+
/**
|
|
87
|
+
* Vertical wrap mode.
|
|
88
|
+
*/
|
|
89
|
+
v_wrap: graphics.TEXTURE_WRAP;
|
|
90
|
+
/**
|
|
91
|
+
* Depth wrap mode.
|
|
92
|
+
*/
|
|
93
|
+
w_wrap: graphics.TEXTURE_WRAP;
|
|
94
|
+
/**
|
|
95
|
+
* Minification filter.
|
|
96
|
+
*/
|
|
97
|
+
min_filter: graphics.TEXTURE_FILTER;
|
|
98
|
+
/**
|
|
99
|
+
* Magnification filter.
|
|
100
|
+
*/
|
|
101
|
+
mag_filter: graphics.TEXTURE_FILTER;
|
|
102
|
+
/**
|
|
103
|
+
* Maximum anisotropy.
|
|
104
|
+
*/
|
|
105
|
+
max_anisotropy: number;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Texture sampler update
|
|
109
|
+
*/
|
|
110
|
+
interface sampler_options {
|
|
111
|
+
/**
|
|
112
|
+
* Horizontal wrap mode.
|
|
113
|
+
*/
|
|
114
|
+
u_wrap?: graphics.TEXTURE_WRAP;
|
|
115
|
+
/**
|
|
116
|
+
* Vertical wrap mode.
|
|
117
|
+
*/
|
|
118
|
+
v_wrap?: graphics.TEXTURE_WRAP;
|
|
119
|
+
/**
|
|
120
|
+
* Depth wrap mode.
|
|
121
|
+
*/
|
|
122
|
+
w_wrap?: graphics.TEXTURE_WRAP;
|
|
123
|
+
/**
|
|
124
|
+
* Minification filter.
|
|
125
|
+
*/
|
|
126
|
+
min_filter?: graphics.TEXTURE_FILTER;
|
|
127
|
+
/**
|
|
128
|
+
* Magnification filter.
|
|
129
|
+
*/
|
|
130
|
+
mag_filter?: graphics.TEXTURE_FILTER;
|
|
131
|
+
/**
|
|
132
|
+
* Maximum anisotropy.
|
|
133
|
+
*/
|
|
134
|
+
max_anisotropy?: number;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Texture information
|
|
138
|
+
*/
|
|
139
|
+
interface texture_info {
|
|
140
|
+
/**
|
|
141
|
+
* Texture resource path, if backed by a resource.
|
|
142
|
+
*/
|
|
143
|
+
path?: Hash;
|
|
144
|
+
/**
|
|
145
|
+
* Runtime texture handle.
|
|
146
|
+
*/
|
|
147
|
+
handle: Opaque<"texture">;
|
|
148
|
+
/**
|
|
149
|
+
* Texture width.
|
|
150
|
+
*/
|
|
151
|
+
width: number;
|
|
152
|
+
/**
|
|
153
|
+
* Texture height.
|
|
154
|
+
*/
|
|
155
|
+
height: number;
|
|
156
|
+
/**
|
|
157
|
+
* Texture depth or layer count.
|
|
158
|
+
*/
|
|
159
|
+
depth: number;
|
|
160
|
+
/**
|
|
161
|
+
* Texture page count.
|
|
162
|
+
*/
|
|
163
|
+
page_count: number;
|
|
164
|
+
/**
|
|
165
|
+
* Mipmap count.
|
|
166
|
+
*/
|
|
167
|
+
mipmaps: number;
|
|
168
|
+
/**
|
|
169
|
+
* Texture type.
|
|
170
|
+
*/
|
|
171
|
+
type: graphics.TEXTURE_TYPE;
|
|
172
|
+
/**
|
|
173
|
+
* Texture usage flags.
|
|
174
|
+
*/
|
|
175
|
+
flags: graphics.TEXTURE_USAGE_FLAG | number;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Material vertex attribute information
|
|
179
|
+
*/
|
|
180
|
+
interface vertex_attribute_info {
|
|
181
|
+
/**
|
|
182
|
+
* Attribute name.
|
|
183
|
+
*/
|
|
184
|
+
name: Hash;
|
|
185
|
+
/**
|
|
186
|
+
* Attribute value.
|
|
187
|
+
*/
|
|
188
|
+
value: material.vertex_attribute_value;
|
|
189
|
+
/**
|
|
190
|
+
* Whether integer data is normalized.
|
|
191
|
+
*/
|
|
192
|
+
normalize: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* Attribute data type.
|
|
195
|
+
*/
|
|
196
|
+
data_type: graphics.DATA_TYPE;
|
|
197
|
+
/**
|
|
198
|
+
* Attribute coordinate space.
|
|
199
|
+
*/
|
|
200
|
+
coordinate_space: graphics.COORDINATE_SPACE;
|
|
201
|
+
/**
|
|
202
|
+
* Attribute semantic.
|
|
203
|
+
*/
|
|
204
|
+
semantic_type: graphics.SEMANTIC_TYPE;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Material vertex attribute update
|
|
208
|
+
*/
|
|
209
|
+
interface vertex_attribute_options {
|
|
210
|
+
/**
|
|
211
|
+
* Attribute value.
|
|
212
|
+
*/
|
|
213
|
+
value?: material.vertex_attribute_value;
|
|
214
|
+
/**
|
|
215
|
+
* Whether integer data is normalized.
|
|
216
|
+
*/
|
|
217
|
+
normalize?: boolean;
|
|
218
|
+
/**
|
|
219
|
+
* Attribute data type.
|
|
220
|
+
*/
|
|
221
|
+
data_type?: graphics.DATA_TYPE;
|
|
222
|
+
/**
|
|
223
|
+
* Attribute coordinate space.
|
|
224
|
+
*/
|
|
225
|
+
coordinate_space?: graphics.COORDINATE_SPACE;
|
|
226
|
+
/**
|
|
227
|
+
* Attribute semantic.
|
|
228
|
+
*/
|
|
229
|
+
semantic_type?: graphics.SEMANTIC_TYPE;
|
|
230
|
+
}
|
|
231
|
+
type vertex_attribute_value = number | Vector3 | Vector4 | Matrix4 | number[];
|
|
232
|
+
type CONSTANT_TYPE = typeof material.CONSTANT_TYPE_USER | typeof material.CONSTANT_TYPE_USER_COLOR | typeof material.CONSTANT_TYPE_USER_MATRIX4 | typeof material.CONSTANT_TYPE_VIEWPROJ | typeof material.CONSTANT_TYPE_WORLD | typeof material.CONSTANT_TYPE_TEXTURE | typeof material.CONSTANT_TYPE_VIEW | typeof material.CONSTANT_TYPE_PROJECTION | typeof material.CONSTANT_TYPE_NORMAL | typeof material.CONSTANT_TYPE_WORLDVIEW | typeof material.CONSTANT_TYPE_WORLDVIEWPROJ | typeof material.CONSTANT_TYPE_TIME | typeof material.CONSTANT_TYPE_WORLD_INVERSE | typeof material.CONSTANT_TYPE_VIEW_INVERSE | typeof material.CONSTANT_TYPE_PROJECTION_INVERSE | typeof material.CONSTANT_TYPE_VIEWPROJ_INVERSE | typeof material.CONSTANT_TYPE_WORLDVIEW_INVERSE | typeof material.CONSTANT_TYPE_WORLDVIEWPROJ_INVERSE;
|
|
233
|
+
/**
|
|
234
|
+
* Normal matrix constant.
|
|
235
|
+
*/
|
|
236
|
+
const CONSTANT_TYPE_NORMAL: number & { readonly __brand: "material.CONSTANT_TYPE_NORMAL" };
|
|
237
|
+
/**
|
|
238
|
+
* Projection matrix constant.
|
|
239
|
+
*/
|
|
240
|
+
const CONSTANT_TYPE_PROJECTION: number & { readonly __brand: "material.CONSTANT_TYPE_PROJECTION" };
|
|
241
|
+
/**
|
|
242
|
+
* Inverse projection matrix constant.
|
|
243
|
+
*/
|
|
244
|
+
const CONSTANT_TYPE_PROJECTION_INVERSE: number & { readonly __brand: "material.CONSTANT_TYPE_PROJECTION_INVERSE" };
|
|
245
|
+
/**
|
|
246
|
+
* Texture matrix constant.
|
|
247
|
+
*/
|
|
248
|
+
const CONSTANT_TYPE_TEXTURE: number & { readonly __brand: "material.CONSTANT_TYPE_TEXTURE" };
|
|
249
|
+
/**
|
|
250
|
+
* Time constant.
|
|
251
|
+
*/
|
|
252
|
+
const CONSTANT_TYPE_TIME: number & { readonly __brand: "material.CONSTANT_TYPE_TIME" };
|
|
253
|
+
/**
|
|
254
|
+
* User vector constant.
|
|
255
|
+
*/
|
|
256
|
+
const CONSTANT_TYPE_USER: number & { readonly __brand: "material.CONSTANT_TYPE_USER" };
|
|
257
|
+
/**
|
|
258
|
+
* User color constant.
|
|
259
|
+
*/
|
|
260
|
+
const CONSTANT_TYPE_USER_COLOR: number & { readonly __brand: "material.CONSTANT_TYPE_USER_COLOR" };
|
|
261
|
+
/**
|
|
262
|
+
* User matrix constant.
|
|
263
|
+
*/
|
|
264
|
+
const CONSTANT_TYPE_USER_MATRIX4: number & { readonly __brand: "material.CONSTANT_TYPE_USER_MATRIX4" };
|
|
265
|
+
/**
|
|
266
|
+
* View matrix constant.
|
|
267
|
+
*/
|
|
268
|
+
const CONSTANT_TYPE_VIEW: number & { readonly __brand: "material.CONSTANT_TYPE_VIEW" };
|
|
269
|
+
/**
|
|
270
|
+
* Inverse view matrix constant.
|
|
271
|
+
*/
|
|
272
|
+
const CONSTANT_TYPE_VIEW_INVERSE: number & { readonly __brand: "material.CONSTANT_TYPE_VIEW_INVERSE" };
|
|
273
|
+
/**
|
|
274
|
+
* View-projection matrix constant.
|
|
275
|
+
*/
|
|
276
|
+
const CONSTANT_TYPE_VIEWPROJ: number & { readonly __brand: "material.CONSTANT_TYPE_VIEWPROJ" };
|
|
277
|
+
/**
|
|
278
|
+
* Inverse view-projection matrix constant.
|
|
279
|
+
*/
|
|
280
|
+
const CONSTANT_TYPE_VIEWPROJ_INVERSE: number & { readonly __brand: "material.CONSTANT_TYPE_VIEWPROJ_INVERSE" };
|
|
281
|
+
/**
|
|
282
|
+
* World matrix constant.
|
|
283
|
+
*/
|
|
284
|
+
const CONSTANT_TYPE_WORLD: number & { readonly __brand: "material.CONSTANT_TYPE_WORLD" };
|
|
285
|
+
/**
|
|
286
|
+
* Inverse world matrix constant.
|
|
287
|
+
*/
|
|
288
|
+
const CONSTANT_TYPE_WORLD_INVERSE: number & { readonly __brand: "material.CONSTANT_TYPE_WORLD_INVERSE" };
|
|
289
|
+
/**
|
|
290
|
+
* World-view matrix constant.
|
|
291
|
+
*/
|
|
292
|
+
const CONSTANT_TYPE_WORLDVIEW: number & { readonly __brand: "material.CONSTANT_TYPE_WORLDVIEW" };
|
|
293
|
+
/**
|
|
294
|
+
* Inverse world-view matrix constant.
|
|
295
|
+
*/
|
|
296
|
+
const CONSTANT_TYPE_WORLDVIEW_INVERSE: number & { readonly __brand: "material.CONSTANT_TYPE_WORLDVIEW_INVERSE" };
|
|
297
|
+
/**
|
|
298
|
+
* World-view-projection matrix constant.
|
|
299
|
+
*/
|
|
300
|
+
const CONSTANT_TYPE_WORLDVIEWPROJ: number & { readonly __brand: "material.CONSTANT_TYPE_WORLDVIEWPROJ" };
|
|
301
|
+
/**
|
|
302
|
+
* Inverse world-view-projection matrix constant.
|
|
303
|
+
*/
|
|
304
|
+
const CONSTANT_TYPE_WORLDVIEWPROJ_INVERSE: number & { readonly __brand: "material.CONSTANT_TYPE_WORLDVIEWPROJ_INVERSE" };
|
|
305
|
+
/**
|
|
306
|
+
* Returns a table of all the shader constants in the material. This function will return all the shader constants
|
|
307
|
+
* that are used in both the vertex and the fragment shaders.
|
|
308
|
+
*
|
|
309
|
+
* @param path - The path to the resource
|
|
310
|
+
* @returns Shader constant information.
|
|
311
|
+
* @example
|
|
312
|
+
* ```ts
|
|
313
|
+
* // Get the shader constants from a material specified as a resource property
|
|
314
|
+
* export default defineScript({
|
|
315
|
+
* // Never call `go.property` yourself: the transpiler emits the chunk-scope
|
|
316
|
+
* // registration from this field, and only this field types the property onto `self`.
|
|
317
|
+
* properties: { my_material: resource.material() },
|
|
318
|
+
*
|
|
319
|
+
* init(self) {
|
|
320
|
+
* const constants = material.get_constants(self.my_material);
|
|
321
|
+
* },
|
|
322
|
+
* });
|
|
323
|
+
* ```
|
|
324
|
+
*/
|
|
325
|
+
function get_constants(path: Hash | string): material.constant_info[];
|
|
326
|
+
/**
|
|
327
|
+
* Returns a table of all the texture samplers in the material. This function will return all the texture samplers
|
|
328
|
+
* that are used in both the vertex and the fragment shaders.
|
|
329
|
+
*
|
|
330
|
+
* @param path - The path to the resource
|
|
331
|
+
* @returns texture sampler information
|
|
332
|
+
* @example
|
|
333
|
+
* ```ts
|
|
334
|
+
* // Get the texture samplers from a material specified as a resource property
|
|
335
|
+
* export default defineScript({
|
|
336
|
+
* // Never call `go.property` yourself: the transpiler emits the chunk-scope
|
|
337
|
+
* // registration from this field, and only this field types the property onto `self`.
|
|
338
|
+
* properties: { my_material: resource.material() },
|
|
339
|
+
*
|
|
340
|
+
* init(self) {
|
|
341
|
+
* const samplers = material.get_samplers(self.my_material);
|
|
342
|
+
* },
|
|
343
|
+
* });
|
|
344
|
+
* ```
|
|
345
|
+
*/
|
|
346
|
+
function get_samplers(path: Hash | string): material.sampler_info[];
|
|
347
|
+
/**
|
|
348
|
+
* Returns a table of all the textures from the material.
|
|
349
|
+
*
|
|
350
|
+
* @param path - The path to the resource
|
|
351
|
+
* @returns material texture information
|
|
352
|
+
* @example
|
|
353
|
+
* ```ts
|
|
354
|
+
* // Get the textures from a material specified as a resource property
|
|
355
|
+
* export default defineScript({
|
|
356
|
+
* // Never call `go.property` yourself: the transpiler emits the chunk-scope
|
|
357
|
+
* // registration from this field, and only this field types the property onto `self`.
|
|
358
|
+
* properties: { my_material: resource.material() },
|
|
359
|
+
*
|
|
360
|
+
* init(self) {
|
|
361
|
+
* const textures = material.get_textures(self.my_material);
|
|
362
|
+
* },
|
|
363
|
+
* });
|
|
364
|
+
* ```
|
|
365
|
+
*/
|
|
366
|
+
function get_textures(path: Hash | string): material.texture_info[];
|
|
367
|
+
/**
|
|
368
|
+
* Returns a table of all the vertex attributes in the material. This function will return all the vertex attributes
|
|
369
|
+
* that are used in the vertex shader of the material.
|
|
370
|
+
*
|
|
371
|
+
* @param path - The path to the resource
|
|
372
|
+
* @returns vertex attribute information
|
|
373
|
+
* @example
|
|
374
|
+
* ```ts
|
|
375
|
+
* // Get the vertex attributes from a material specified as a resource property
|
|
376
|
+
* export default defineScript({
|
|
377
|
+
* // Never call `go.property` yourself: the transpiler emits the chunk-scope
|
|
378
|
+
* // registration from this field, and only this field types the property onto `self`.
|
|
379
|
+
* properties: { my_material: resource.material() },
|
|
380
|
+
*
|
|
381
|
+
* init(self) {
|
|
382
|
+
* const vertex_attributes = material.get_vertex_attributes(self.my_material);
|
|
383
|
+
* },
|
|
384
|
+
* });
|
|
385
|
+
* ```
|
|
386
|
+
*/
|
|
387
|
+
function get_vertex_attributes(path: Hash | string): material.vertex_attribute_info[];
|
|
388
|
+
/**
|
|
389
|
+
* Sets shader constants in a material, if the constants exist.
|
|
390
|
+
*
|
|
391
|
+
* @param path - The path to the resource
|
|
392
|
+
* @param constants - Shader constant updates keyed by constant name. Partial updates are supported.
|
|
393
|
+
* @example
|
|
394
|
+
* ```ts
|
|
395
|
+
* // Set a shader constant in a material specified as a resource property
|
|
396
|
+
* export default defineScript({
|
|
397
|
+
* // Never call `go.property` yourself: the transpiler emits the chunk-scope
|
|
398
|
+
* // registration from this field, and only this field types the property onto `self`.
|
|
399
|
+
* properties: { my_material: resource.material() },
|
|
400
|
+
*
|
|
401
|
+
* init() {
|
|
402
|
+
* return { my_view_proj: vmath.matrix4() };
|
|
403
|
+
* },
|
|
404
|
+
*
|
|
405
|
+
* update(self) {
|
|
406
|
+
* // update the 'tint' constant
|
|
407
|
+
* material.set_constants(self.my_material, {
|
|
408
|
+
* tint: { value: vmath.vector4(1, 0, 0, 1) },
|
|
409
|
+
* });
|
|
410
|
+
* // change the type of the 'view_proj' constant to CONSTANT_TYPE_USER_MATRIX4 so the renderer can set our custom data
|
|
411
|
+
* material.set_constants(self.my_material, {
|
|
412
|
+
* view_proj: { value: self.my_view_proj, type: material.CONSTANT_TYPE_USER_MATRIX4 },
|
|
413
|
+
* });
|
|
414
|
+
* },
|
|
415
|
+
* });
|
|
416
|
+
* ```
|
|
417
|
+
*/
|
|
418
|
+
function set_constants(path: Hash | string, constants: LuaMap<string | Hash, material.constant_options> | Record<string, material.constant_options>): void;
|
|
419
|
+
/**
|
|
420
|
+
* Sets texture samplers in a material, if the samplers exist. Use this function to change the settings of texture samplers.
|
|
421
|
+
* To set actual textures that should be bound to the samplers, use the `material.set_textures` function instead.
|
|
422
|
+
*
|
|
423
|
+
* @param path - The path to the resource
|
|
424
|
+
* @param samplers - Sampler updates keyed by sampler name. Partial updates are supported.
|
|
425
|
+
* @example
|
|
426
|
+
* ```ts
|
|
427
|
+
* // Configures a sampler in a material specified as a resource property
|
|
428
|
+
* export default defineScript({
|
|
429
|
+
* // Never call `go.property` yourself: the transpiler emits the chunk-scope
|
|
430
|
+
* // registration from this field, and only this field types the property onto `self`.
|
|
431
|
+
* properties: { my_material: resource.material() },
|
|
432
|
+
*
|
|
433
|
+
* init(self) {
|
|
434
|
+
* material.set_samplers(self.my_material, {
|
|
435
|
+
* texture_sampler: { u_wrap: graphics.TEXTURE_WRAP_REPEAT, v_wrap: graphics.TEXTURE_WRAP_MIRRORED_REPEAT },
|
|
436
|
+
* });
|
|
437
|
+
* },
|
|
438
|
+
* });
|
|
439
|
+
* ```
|
|
440
|
+
*/
|
|
441
|
+
function set_samplers(path: Hash | string, samplers: LuaMap<string | Hash, material.sampler_options> | Record<string, material.sampler_options>): void;
|
|
442
|
+
/**
|
|
443
|
+
* Sets textures in a material, if the samplers exist.
|
|
444
|
+
*
|
|
445
|
+
* @param path - The path to the resource
|
|
446
|
+
* @param textures - A table keyed by sampler name with texture resources as values.
|
|
447
|
+
* @example
|
|
448
|
+
* ```ts
|
|
449
|
+
* // Set a texture in a material from a resource
|
|
450
|
+
* export default defineScript({
|
|
451
|
+
* // Never call `go.property` yourself: the transpiler emits the chunk-scope
|
|
452
|
+
* // registrations from this field, and only this field types them onto `self`.
|
|
453
|
+
* properties: { my_material: resource.material(), my_texture: resource.texture() },
|
|
454
|
+
*
|
|
455
|
+
* init(self) {
|
|
456
|
+
* material.set_textures(self.my_material, {
|
|
457
|
+
* my_texture: self.my_texture,
|
|
458
|
+
* });
|
|
459
|
+
* },
|
|
460
|
+
* });
|
|
461
|
+
* ```
|
|
462
|
+
*/
|
|
463
|
+
function set_textures(path: Hash | string, textures: LuaMap<string | Hash, string | Hash> | Record<string, string | Hash>): void;
|
|
464
|
+
/**
|
|
465
|
+
* Sets vertex attributes in a material, if the vertex attributes exist.
|
|
466
|
+
*
|
|
467
|
+
* @param path - The path to the resource
|
|
468
|
+
* @param attributes - Vertex attributes keyed by name, or an array with explicit `name` fields. Partial updates are supported.
|
|
469
|
+
* @example
|
|
470
|
+
* ```ts
|
|
471
|
+
* // Configures a vertex attribute in a material specified as a resource property
|
|
472
|
+
* export default defineScript({
|
|
473
|
+
* // Never call `go.property` yourself: the transpiler emits the chunk-scope
|
|
474
|
+
* // registration from this field, and only this field types the property onto `self`.
|
|
475
|
+
* properties: { my_material: resource.material() },
|
|
476
|
+
*
|
|
477
|
+
* init(self) {
|
|
478
|
+
* material.set_vertex_attributes(self.my_material, {
|
|
479
|
+
* tint_attribute: { value: vmath.vector4(1, 0, 0, 1), semantic_type: graphics.SEMANTIC_TYPE_COLOR },
|
|
480
|
+
* weights: { value: vmath.vector4(0, 1, 0, 0), semantic_type: graphics.SEMANTIC_TYPE_NONE },
|
|
481
|
+
* });
|
|
482
|
+
* },
|
|
483
|
+
* });
|
|
484
|
+
* ```
|
|
485
|
+
*/
|
|
486
|
+
function set_vertex_attributes(path: Hash | string, attributes: LuaMap<string | Hash, material.vertex_attribute_options> | Record<string, material.vertex_attribute_options> | material.named_vertex_attribute_options[]): void;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export {};
|