@defold-typescript/types 0.40.0 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api-availability.json +3963 -772
- package/api-migrations.json +27 -0
- package/api-signatures.json +18069 -10240
- package/api-targets.json +448 -11
- package/examples/translations.json +560 -89
- package/fixtures/messages_doc.json +96 -0
- package/generated/b2d.d.ts +680 -4
- package/generated/b2d_body.d.ts +29 -103
- package/generated/b2d_chain.d.ts +5 -6
- package/generated/b2d_fixture.d.ts +34 -38
- package/generated/b2d_joint.d.ts +503 -25
- package/generated/b2d_shape.d.ts +183 -20
- package/generated/b2d_world.d.ts +57 -63
- package/generated/buffer.d.ts +16 -15
- package/generated/builtin-messages.d.ts +7 -1
- package/generated/bullet3d.d.ts +91 -0
- package/generated/bullet3d_collision_object.d.ts +433 -0
- package/generated/bullet3d_constraint.d.ts +818 -0
- package/generated/bullet3d_rigid_body.d.ts +429 -0
- package/generated/bullet3d_shape.d.ts +123 -0
- package/generated/bullet3d_world.d.ts +492 -0
- package/generated/camera.d.ts +29 -32
- package/generated/collectionfactory.d.ts +15 -18
- package/generated/collectionproxy.d.ts +22 -6
- package/generated/compute.d.ts +12 -238
- package/generated/crash.d.ts +24 -10
- package/generated/editor-vm/http.d.ts +90 -7
- package/generated/editor-vm/image.d.ts +7 -7
- package/generated/editor-vm/json.d.ts +11 -0
- package/generated/editor-vm/localization.d.ts +7 -7
- package/generated/editor-vm/tilemap_tiles.d.ts +56 -10
- package/generated/editor-vm/zip.d.ts +28 -0
- package/generated/editor.d.ts +1496 -430
- package/generated/factory.d.ts +21 -25
- package/generated/font.d.ts +64 -22
- package/generated/go.d.ts +235 -182
- package/generated/graphics.d.ts +335 -97
- package/generated/gui.d.ts +240 -471
- package/generated/html5.d.ts +2 -2
- package/generated/http.d.ts +28 -35
- package/generated/image.d.ts +105 -72
- package/generated/json.d.ts +34 -16
- 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 +77 -7
- package/generated/liveupdate.d.ts +13 -10
- package/generated/material.d.ts +312 -360
- package/generated/model.d.ts +40 -39
- package/generated/particlefx.d.ts +19 -28
- package/generated/physics.d.ts +365 -133
- package/generated/profiler.d.ts +13 -23
- package/generated/render.d.ts +237 -297
- package/generated/resource.d.ts +664 -583
- package/generated/socket.d.ts +120 -133
- package/generated/sound.d.ts +62 -31
- package/generated/sprite.d.ts +31 -17
- package/generated/sys.d.ts +234 -190
- package/generated/tilemap.d.ts +21 -16
- package/generated/timer.d.ts +34 -21
- package/generated/versions/defold-1.12.4/b2d_body.d.ts +0 -7
- package/generated/versions/defold-1.12.4/buffer.d.ts +1 -3
- package/generated/versions/defold-1.12.4/camera.d.ts +21 -21
- package/generated/versions/defold-1.12.4/collectionfactory.d.ts +9 -9
- package/generated/versions/defold-1.12.4/collectionproxy.d.ts +2 -2
- package/generated/versions/defold-1.12.4/crash.d.ts +2 -2
- package/generated/versions/defold-1.12.4/factory.d.ts +15 -16
- package/generated/versions/defold-1.12.4/go.d.ts +6 -12
- package/generated/versions/defold-1.12.4/gui.d.ts +77 -175
- package/generated/versions/defold-1.12.4/html5.d.ts +1 -1
- package/generated/versions/defold-1.12.4/http.d.ts +0 -13
- package/generated/versions/defold-1.12.4/image.d.ts +16 -33
- package/generated/versions/defold-1.12.4/index.d.ts +1 -0
- package/generated/versions/defold-1.12.4/json.d.ts +10 -6
- package/generated/versions/defold-1.12.4/label.d.ts +2 -3
- package/generated/versions/defold-1.12.4/liveupdate.d.ts +5 -3
- package/generated/versions/defold-1.12.4/model.d.ts +2 -10
- package/generated/versions/defold-1.12.4/particlefx.d.ts +2 -5
- package/generated/versions/defold-1.12.4/physics.d.ts +69 -67
- package/generated/versions/defold-1.12.4/profiler.d.ts +2 -5
- package/generated/versions/defold-1.12.4/render.d.ts +99 -128
- package/generated/versions/defold-1.12.4/resource.d.ts +120 -148
- package/generated/versions/defold-1.12.4/socket.d.ts +34 -60
- package/generated/versions/defold-1.12.4/sound.d.ts +8 -8
- package/generated/versions/defold-1.12.4/sprite.d.ts +15 -5
- package/generated/versions/defold-1.12.4/sys.d.ts +37 -71
- package/generated/versions/defold-1.12.4/tilemap.d.ts +18 -11
- package/generated/versions/defold-1.12.4/timer.d.ts +5 -3
- package/generated/versions/defold-1.12.4/vmath.d.ts +0 -21
- package/generated/versions/defold-1.12.4/window.d.ts +1 -16
- package/generated/versions/defold-1.13.0/b2d_body.d.ts +10 -55
- package/generated/versions/defold-1.13.0/b2d_fixture.d.ts +25 -25
- package/generated/versions/defold-1.13.0/b2d_shape.d.ts +169 -8
- package/generated/versions/defold-1.13.0/b2d_world.d.ts +16 -10
- package/generated/versions/defold-1.13.0/buffer.d.ts +1 -3
- package/generated/versions/defold-1.13.0/camera.d.ts +25 -25
- package/generated/versions/defold-1.13.0/collectionfactory.d.ts +9 -9
- package/generated/versions/defold-1.13.0/collectionproxy.d.ts +2 -2
- package/generated/versions/defold-1.13.0/compute.d.ts +0 -69
- package/generated/versions/defold-1.13.0/crash.d.ts +2 -2
- package/generated/versions/defold-1.13.0/editor-vm/tilemap_tiles.d.ts +3 -3
- package/generated/versions/defold-1.13.0/editor.d.ts +34 -24
- package/generated/versions/defold-1.13.0/factory.d.ts +15 -16
- package/generated/versions/defold-1.13.0/go.d.ts +6 -12
- package/generated/versions/defold-1.13.0/graphics.d.ts +73 -37
- package/generated/versions/defold-1.13.0/gui.d.ts +77 -175
- package/generated/versions/defold-1.13.0/html5.d.ts +1 -1
- package/generated/versions/defold-1.13.0/http.d.ts +0 -13
- package/generated/versions/defold-1.13.0/image.d.ts +16 -33
- package/generated/versions/defold-1.13.0/index.d.ts +1 -0
- package/generated/versions/defold-1.13.0/json.d.ts +10 -6
- package/generated/versions/defold-1.13.0/label.d.ts +2 -3
- package/generated/versions/defold-1.13.0/liveupdate.d.ts +7 -5
- package/generated/versions/defold-1.13.0/material.d.ts +68 -106
- package/generated/versions/defold-1.13.0/model.d.ts +2 -10
- package/generated/versions/defold-1.13.0/particlefx.d.ts +2 -5
- package/generated/versions/defold-1.13.0/physics.d.ts +69 -67
- package/generated/versions/defold-1.13.0/profiler.d.ts +2 -5
- package/generated/versions/defold-1.13.0/render.d.ts +99 -128
- package/generated/versions/defold-1.13.0/resource.d.ts +126 -150
- package/generated/versions/defold-1.13.0/socket.d.ts +34 -60
- package/generated/versions/defold-1.13.0/sound.d.ts +8 -8
- package/generated/versions/defold-1.13.0/sprite.d.ts +15 -5
- package/generated/versions/defold-1.13.0/sys.d.ts +37 -71
- package/generated/versions/defold-1.13.0/tilemap.d.ts +18 -11
- package/generated/versions/defold-1.13.0/timer.d.ts +5 -3
- package/generated/versions/defold-1.13.0/vmath.d.ts +0 -21
- package/generated/versions/defold-1.13.0/window.d.ts +1 -16
- package/generated/versions/defold-1.13.1/b2d.d.ts +33 -0
- package/generated/versions/defold-1.13.1/b2d_body.d.ts +636 -0
- package/generated/versions/defold-1.13.1/b2d_chain.d.ts +106 -0
- package/generated/versions/defold-1.13.1/b2d_fixture.d.ts +157 -0
- package/generated/versions/defold-1.13.1/b2d_joint.d.ts +823 -0
- package/generated/versions/defold-1.13.1/b2d_shape.d.ts +400 -0
- package/generated/versions/defold-1.13.1/b2d_world.d.ts +320 -0
- package/generated/versions/defold-1.13.1/buffer.d.ts +189 -0
- package/generated/versions/defold-1.13.1/camera.d.ts +303 -0
- package/generated/versions/defold-1.13.1/collectionfactory.d.ts +151 -0
- package/generated/versions/defold-1.13.1/collectionproxy.d.ts +93 -0
- package/generated/versions/defold-1.13.1/compute.d.ts +237 -0
- package/generated/versions/defold-1.13.1/crash.d.ts +143 -0
- package/generated/versions/defold-1.13.1/editor-vm/http.d.ts +56 -0
- package/generated/versions/defold-1.13.1/editor-vm/image.d.ts +48 -0
- package/generated/versions/defold-1.13.1/editor-vm/json.d.ts +10 -0
- package/generated/versions/defold-1.13.1/editor-vm/localization.d.ts +42 -0
- package/generated/versions/defold-1.13.1/editor-vm/tilemap_tiles.d.ts +80 -0
- package/generated/versions/defold-1.13.1/editor-vm/zip.d.ts +10 -0
- package/generated/versions/defold-1.13.1/editor-vm/zlib.d.ts +24 -0
- package/generated/versions/defold-1.13.1/editor.d.ts +1121 -0
- package/generated/versions/defold-1.13.1/factory.d.ts +124 -0
- package/generated/versions/defold-1.13.1/font.d.ts +81 -0
- package/generated/versions/defold-1.13.1/go.d.ts +1107 -0
- package/generated/versions/defold-1.13.1/graphics.d.ts +411 -0
- package/generated/versions/defold-1.13.1/gui.d.ts +2353 -0
- package/generated/versions/defold-1.13.1/html5.d.ts +55 -0
- package/generated/versions/defold-1.13.1/http.d.ts +77 -0
- package/generated/versions/defold-1.13.1/image.d.ts +131 -0
- package/generated/versions/defold-1.13.1/index.d.ts +57 -0
- package/generated/versions/defold-1.13.1/json.d.ts +80 -0
- package/generated/versions/defold-1.13.1/kinds/editor-script.d.ts +14 -0
- package/generated/versions/defold-1.13.1/label.d.ts +93 -0
- package/generated/versions/defold-1.13.1/liveupdate.d.ts +142 -0
- package/generated/versions/defold-1.13.1/material.d.ts +408 -0
- package/generated/versions/defold-1.13.1/model.d.ts +272 -0
- package/generated/versions/defold-1.13.1/msg.d.ts +10 -0
- package/generated/versions/defold-1.13.1/particlefx.d.ts +163 -0
- package/generated/versions/defold-1.13.1/physics.d.ts +559 -0
- package/generated/versions/defold-1.13.1/profiler.d.ts +235 -0
- package/generated/versions/defold-1.13.1/render.d.ts +1190 -0
- package/generated/versions/defold-1.13.1/resource.d.ts +1523 -0
- package/generated/versions/defold-1.13.1/socket.d.ts +784 -0
- package/generated/versions/defold-1.13.1/sound.d.ts +292 -0
- package/generated/versions/defold-1.13.1/sprite.d.ts +175 -0
- package/generated/versions/defold-1.13.1/sys.d.ts +678 -0
- package/generated/versions/defold-1.13.1/tilemap.d.ts +208 -0
- package/generated/versions/defold-1.13.1/timer.d.ts +125 -0
- package/generated/versions/defold-1.13.1/types.d.ts +61 -0
- package/generated/versions/defold-1.13.1/vmath.d.ts +774 -0
- package/generated/versions/defold-1.13.1/window.d.ts +183 -0
- package/generated/versions/defold-1.13.1/zlib.d.ts +41 -0
- package/generated/vmath.d.ts +1 -21
- package/generated/window.d.ts +71 -71
- package/identity-vocabulary.json +561 -0
- package/index.d.ts +7 -0
- package/package.json +18 -2
- package/scripts/example-store-io.ts +12 -1
- package/scripts/extension-goldens.ts +1 -0
- package/scripts/fidelity-baseline.json +146 -46
- package/scripts/generate-api-availability.ts +90 -12
- package/scripts/generate-api-signatures.ts +12 -2
- package/scripts/import-defold-release.ts +106 -26
- package/scripts/prose-constants.ts +77 -16
- package/scripts/regen.ts +391 -77
- package/scripts/shared-handle-methods.ts +53 -0
- package/scripts/signature-store-fs.ts +1 -0
- package/scripts/sync-api-docs.ts +48 -10
- package/src/api-availability.ts +0 -0
- package/src/api-doc.ts +201 -3
- package/src/api-identity.ts +252 -0
- package/src/core-types.ts +26 -3
- package/src/correction-pins.ts +49 -0
- package/src/doc-comment.ts +104 -11
- package/src/doc-corrections.ts +108 -0
- package/src/editor-vm-globals.d.ts +5 -2
- package/src/emit-dts.ts +2064 -281
- package/src/emit-messages.ts +52 -0
- package/src/example-store.ts +125 -14
- package/src/field-correction-coverage.ts +204 -0
- package/src/fnv1a.ts +16 -0
- package/src/go-overloads.d.ts +25 -6
- package/src/index-base-table.ts +145 -0
- package/src/index-slot-classifications.ts +588 -0
- package/src/index.ts +38 -5
- package/src/library-index-slot-classifications.ts +332 -0
- package/src/lifecycle.ts +61 -199
- package/src/luals-type-expr.ts +354 -0
- package/src/msg-overloads.d.ts +0 -1
- package/src/param-correction-provenance.ts +8 -11
- package/src/render-overloads.d.ts +0 -15
- package/src/return-correction-provenance.ts +58 -16
- package/src/sys-overloads.d.ts +48 -0
- package/src/vmath-overloads.d.ts +27 -1
- package/src/window-event-guard.d.ts +6 -9
- package/url-parameters.json +1 -2
|
@@ -0,0 +1,408 @@
|
|
|
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
|
+
* Material constant type, for `material.set_constants`.
|
|
11
|
+
*/
|
|
12
|
+
const CONSTANT_TYPE_NORMAL: number & { readonly __brand: "material.CONSTANT_TYPE_NORMAL" };
|
|
13
|
+
/**
|
|
14
|
+
* Material constant type, for `material.set_constants`.
|
|
15
|
+
*/
|
|
16
|
+
const CONSTANT_TYPE_PROJECTION: number & { readonly __brand: "material.CONSTANT_TYPE_PROJECTION" };
|
|
17
|
+
/**
|
|
18
|
+
* Material constant type, for `material.set_constants`.
|
|
19
|
+
*/
|
|
20
|
+
const CONSTANT_TYPE_PROJECTION_INVERSE: number & { readonly __brand: "material.CONSTANT_TYPE_PROJECTION_INVERSE" };
|
|
21
|
+
/**
|
|
22
|
+
* Material constant type, for `material.set_constants`.
|
|
23
|
+
*/
|
|
24
|
+
const CONSTANT_TYPE_TEXTURE: number & { readonly __brand: "material.CONSTANT_TYPE_TEXTURE" };
|
|
25
|
+
/**
|
|
26
|
+
* Material constant type, for `material.set_constants`.
|
|
27
|
+
*/
|
|
28
|
+
const CONSTANT_TYPE_TIME: number & { readonly __brand: "material.CONSTANT_TYPE_TIME" };
|
|
29
|
+
/**
|
|
30
|
+
* Material constant type, for `material.set_constants`.
|
|
31
|
+
*/
|
|
32
|
+
const CONSTANT_TYPE_USER: number & { readonly __brand: "material.CONSTANT_TYPE_USER" };
|
|
33
|
+
/**
|
|
34
|
+
* Material constant type, for `material.set_constants`.
|
|
35
|
+
*/
|
|
36
|
+
const CONSTANT_TYPE_USER_MATRIX4: number & { readonly __brand: "material.CONSTANT_TYPE_USER_MATRIX4" };
|
|
37
|
+
/**
|
|
38
|
+
* Material constant type, for `material.set_constants`.
|
|
39
|
+
*/
|
|
40
|
+
const CONSTANT_TYPE_VIEW: number & { readonly __brand: "material.CONSTANT_TYPE_VIEW" };
|
|
41
|
+
/**
|
|
42
|
+
* Material constant type, for `material.set_constants`.
|
|
43
|
+
*/
|
|
44
|
+
const CONSTANT_TYPE_VIEW_INVERSE: number & { readonly __brand: "material.CONSTANT_TYPE_VIEW_INVERSE" };
|
|
45
|
+
/**
|
|
46
|
+
* Material constant type, for `material.set_constants`.
|
|
47
|
+
*/
|
|
48
|
+
const CONSTANT_TYPE_VIEWPROJ: number & { readonly __brand: "material.CONSTANT_TYPE_VIEWPROJ" };
|
|
49
|
+
/**
|
|
50
|
+
* Material constant type, for `material.set_constants`.
|
|
51
|
+
*/
|
|
52
|
+
const CONSTANT_TYPE_VIEWPROJ_INVERSE: number & { readonly __brand: "material.CONSTANT_TYPE_VIEWPROJ_INVERSE" };
|
|
53
|
+
/**
|
|
54
|
+
* Material constant type, for `material.set_constants`.
|
|
55
|
+
*/
|
|
56
|
+
const CONSTANT_TYPE_WORLD: number & { readonly __brand: "material.CONSTANT_TYPE_WORLD" };
|
|
57
|
+
/**
|
|
58
|
+
* Material constant type, for `material.set_constants`.
|
|
59
|
+
*/
|
|
60
|
+
const CONSTANT_TYPE_WORLD_INVERSE: number & { readonly __brand: "material.CONSTANT_TYPE_WORLD_INVERSE" };
|
|
61
|
+
/**
|
|
62
|
+
* Material constant type, for `material.set_constants`.
|
|
63
|
+
*/
|
|
64
|
+
const CONSTANT_TYPE_WORLDVIEW: number & { readonly __brand: "material.CONSTANT_TYPE_WORLDVIEW" };
|
|
65
|
+
/**
|
|
66
|
+
* Material constant type, for `material.set_constants`.
|
|
67
|
+
*/
|
|
68
|
+
const CONSTANT_TYPE_WORLDVIEW_INVERSE: number & { readonly __brand: "material.CONSTANT_TYPE_WORLDVIEW_INVERSE" };
|
|
69
|
+
/**
|
|
70
|
+
* Material constant type, for `material.set_constants`.
|
|
71
|
+
*/
|
|
72
|
+
const CONSTANT_TYPE_WORLDVIEWPROJ: number & { readonly __brand: "material.CONSTANT_TYPE_WORLDVIEWPROJ" };
|
|
73
|
+
/**
|
|
74
|
+
* Material constant type, for `material.set_constants`.
|
|
75
|
+
*/
|
|
76
|
+
const CONSTANT_TYPE_WORLDVIEWPROJ_INVERSE: number & { readonly __brand: "material.CONSTANT_TYPE_WORLDVIEWPROJ_INVERSE" };
|
|
77
|
+
/**
|
|
78
|
+
* Returns a table of all the shader constants in the material. This function will return all the shader constants
|
|
79
|
+
* that are used in both the vertex and the fragment shaders.
|
|
80
|
+
*
|
|
81
|
+
* @param path - The path to the resource
|
|
82
|
+
* @returns A table of tables, where each entry contains info about the shader constants:
|
|
83
|
+
*
|
|
84
|
+
* `name`
|
|
85
|
+
* hash the hashed name of the constant
|
|
86
|
+
* `type`
|
|
87
|
+
* number the type of the constant. Supported values:
|
|
88
|
+
*
|
|
89
|
+
* - `material.CONSTANT_TYPE_USER`
|
|
90
|
+
* - `material.CONSTANT_TYPE_USER_MATRIX4`
|
|
91
|
+
* - `material.CONSTANT_TYPE_VIEWPROJ`
|
|
92
|
+
* - `material.CONSTANT_TYPE_WORLD`
|
|
93
|
+
* - `material.CONSTANT_TYPE_TEXTURE`
|
|
94
|
+
* - `material.CONSTANT_TYPE_VIEW`
|
|
95
|
+
* - `material.CONSTANT_TYPE_PROJECTION`
|
|
96
|
+
* - `material.CONSTANT_TYPE_NORMAL`
|
|
97
|
+
* - `material.CONSTANT_TYPE_WORLDVIEW`
|
|
98
|
+
* - `material.CONSTANT_TYPE_WORLDVIEWPROJ`
|
|
99
|
+
* - `material.CONSTANT_TYPE_TIME`
|
|
100
|
+
* - `material.CONSTANT_TYPE_WORLD_INVERSE`
|
|
101
|
+
* - `material.CONSTANT_TYPE_VIEW_INVERSE`
|
|
102
|
+
* - `material.CONSTANT_TYPE_PROJECTION_INVERSE`
|
|
103
|
+
* - `material.CONSTANT_TYPE_VIEWPROJ_INVERSE`
|
|
104
|
+
* - `material.CONSTANT_TYPE_WORLDVIEW_INVERSE`
|
|
105
|
+
* - `material.CONSTANT_TYPE_WORLDVIEWPROJ_INVERSE`
|
|
106
|
+
*
|
|
107
|
+
* `value`
|
|
108
|
+
* 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`.
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* const constants = material.get_constants(resource.material("/my_material.materialc"));
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
function get_constants(path: Hash | string): { name: Hash; type: number; value: Vector4 | Matrix4 }[];
|
|
115
|
+
/**
|
|
116
|
+
* Returns a table of all the texture samplers in the material. This function will return all the texture samplers
|
|
117
|
+
* that are used in both the vertex and the fragment shaders.
|
|
118
|
+
*
|
|
119
|
+
* @param path - The path to the resource
|
|
120
|
+
* @returns A table of tables, where each entry contains info about the texture samplers:
|
|
121
|
+
*
|
|
122
|
+
* `name`
|
|
123
|
+
* hash the hashed name of the texture sampler
|
|
124
|
+
* `u_wrap`
|
|
125
|
+
* number the u wrap mode of the texture sampler. Supported values:
|
|
126
|
+
*
|
|
127
|
+
* - `graphics.TEXTURE_WRAP_CLAMP_TO_BORDER`
|
|
128
|
+
* - `graphics.TEXTURE_WRAP_CLAMP_TO_EDGE`
|
|
129
|
+
* - `graphics.TEXTURE_WRAP_MIRRORED_REPEAT`
|
|
130
|
+
* - `graphics.TEXTURE_WRAP_REPEAT`
|
|
131
|
+
*
|
|
132
|
+
* `v_wrap`
|
|
133
|
+
* number the v wrap mode of the texture sampler. Supported values:
|
|
134
|
+
*
|
|
135
|
+
* - `graphics.TEXTURE_WRAP_CLAMP_TO_BORDER`
|
|
136
|
+
* - `graphics.TEXTURE_WRAP_CLAMP_TO_EDGE`
|
|
137
|
+
* - `graphics.TEXTURE_WRAP_MIRRORED_REPEAT`
|
|
138
|
+
* - `graphics.TEXTURE_WRAP_REPEAT`
|
|
139
|
+
*
|
|
140
|
+
* `min_filter`
|
|
141
|
+
* number the min filter mode of the texture sampler. Supported values:
|
|
142
|
+
*
|
|
143
|
+
* - `graphics.TEXTURE_FILTER_DEFAULT`
|
|
144
|
+
* - `graphics.TEXTURE_FILTER_NEAREST`
|
|
145
|
+
* - `graphics.TEXTURE_FILTER_LINEAR`
|
|
146
|
+
* - `graphics.TEXTURE_FILTER_NEAREST_MIPMAP_NEAREST`
|
|
147
|
+
* - `graphics.TEXTURE_FILTER_NEAREST_MIPMAP_LINEAR`
|
|
148
|
+
* - `graphics.TEXTURE_FILTER_LINEAR_MIPMAP_NEAREST`
|
|
149
|
+
* - `graphics.TEXTURE_FILTER_LINEAR_MIPMAP_LINEAR`
|
|
150
|
+
*
|
|
151
|
+
* `mag_filter`
|
|
152
|
+
* number the mag filter mode of the texture sampler
|
|
153
|
+
*
|
|
154
|
+
* - `graphics.TEXTURE_FILTER_DEFAULT`
|
|
155
|
+
* - `graphics.TEXTURE_FILTER_NEAREST`
|
|
156
|
+
* - `graphics.TEXTURE_FILTER_LINEAR`
|
|
157
|
+
*
|
|
158
|
+
* `max_anisotropy`
|
|
159
|
+
* number the max anisotropy of the texture sampler
|
|
160
|
+
* @example
|
|
161
|
+
* ```ts
|
|
162
|
+
* const samplers = material.get_samplers(resource.material("/my_material.materialc"));
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
function get_samplers(path: Hash | string): { name: Hash; u_wrap: number; v_wrap: number; min_filter: number; mag_filter: number; max_anisotropy: number }[];
|
|
166
|
+
/**
|
|
167
|
+
* Returns a table of all the textures from the material.
|
|
168
|
+
*
|
|
169
|
+
* @param path - The path to the resource
|
|
170
|
+
* @returns A table of tables, where each entry contains info about the material textures:
|
|
171
|
+
*
|
|
172
|
+
* `path`
|
|
173
|
+
* hash the resource path of the texture. Only available if the texture is a resource.
|
|
174
|
+
* `handle`
|
|
175
|
+
* hash the runtime handle of the texture.
|
|
176
|
+
* `width`
|
|
177
|
+
* number the width of the texture
|
|
178
|
+
* `height`
|
|
179
|
+
* number the height of the texture
|
|
180
|
+
* `depth`
|
|
181
|
+
* number the depth of the texture. Corresponds to the number of layers in an array texture.
|
|
182
|
+
* `mipmaps`
|
|
183
|
+
* number the number of mipmaps in the texture
|
|
184
|
+
* `type`
|
|
185
|
+
* number the type of the texture. Supported values:
|
|
186
|
+
*
|
|
187
|
+
* - `graphics.TEXTURE_TYPE_2D`
|
|
188
|
+
* - `graphics.TEXTURE_TYPE_2D_ARRAY`
|
|
189
|
+
* - `graphics.TEXTURE_TYPE_CUBE_MAP`
|
|
190
|
+
* - `graphics.TEXTURE_TYPE_IMAGE_2D`
|
|
191
|
+
* - `graphics.TEXTURE_TYPE_3D`
|
|
192
|
+
* - `graphics.TEXTURE_TYPE_IMAGE_3D`
|
|
193
|
+
*
|
|
194
|
+
* `flags`
|
|
195
|
+
* number the flags of the texture. This field is a bit mask of these supported flags:
|
|
196
|
+
*
|
|
197
|
+
* - `graphics.TEXTURE_USAGE_FLAG_SAMPLE`
|
|
198
|
+
* - `graphics.TEXTURE_USAGE_FLAG_MEMORYLESS`
|
|
199
|
+
* - `graphics.TEXTURE_USAGE_FLAG_STORAGE`
|
|
200
|
+
* - `graphics.TEXTURE_USAGE_FLAG_INPUT`
|
|
201
|
+
* - `graphics.TEXTURE_USAGE_FLAG_COLOR`
|
|
202
|
+
* @example
|
|
203
|
+
* ```ts
|
|
204
|
+
* const textures = material.get_textures(resource.material("/my_material.materialc"));
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
function get_textures(path: Hash | string): { path: Hash; handle: Hash; width: number; height: number; depth: number; mipmaps: number; type: number; flags: number }[];
|
|
208
|
+
/**
|
|
209
|
+
* Returns a table of all the vertex attributes in the material. This function will return all the vertex attributes
|
|
210
|
+
* that are used in the vertex shader of the material.
|
|
211
|
+
*
|
|
212
|
+
* @param path - The path to the resource
|
|
213
|
+
* @returns A table of tables, where each entry contains info about the vertex attributes:
|
|
214
|
+
*
|
|
215
|
+
* `name`
|
|
216
|
+
* hash the hashed name of the vertex attribute
|
|
217
|
+
* `value`
|
|
218
|
+
* 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.
|
|
219
|
+
* `normalize`
|
|
220
|
+
* boolean whether the value is normalized when passed into the shader
|
|
221
|
+
* `data_type`
|
|
222
|
+
* number the data type of the vertex attribute. Supported values:
|
|
223
|
+
*
|
|
224
|
+
* - `graphics.DATA_TYPE_BYTE`
|
|
225
|
+
* - `graphics.DATA_TYPE_UNSIGNED_BYTE`
|
|
226
|
+
* - `graphics.DATA_TYPE_SHORT`
|
|
227
|
+
* - `graphics.DATA_TYPE_UNSIGNED_SHORT`
|
|
228
|
+
* - `graphics.DATA_TYPE_INT`
|
|
229
|
+
* - `graphics.DATA_TYPE_UNSIGNED_INT`
|
|
230
|
+
* - `graphics.DATA_TYPE_FLOAT`
|
|
231
|
+
*
|
|
232
|
+
* `coordinate_space`
|
|
233
|
+
* number the coordinate space of the vertex attribute. Supported values:
|
|
234
|
+
*
|
|
235
|
+
* - `graphics.COORDINATE_SPACE_WORLD`
|
|
236
|
+
* - `graphics.COORDINATE_SPACE_LOCAL`
|
|
237
|
+
*
|
|
238
|
+
* `semantic_type`
|
|
239
|
+
* number the semantic type of the vertex attribute. Supported values:
|
|
240
|
+
*
|
|
241
|
+
* - `graphics.SEMANTIC_TYPE_NONE`
|
|
242
|
+
* - `graphics.SEMANTIC_TYPE_POSITION`
|
|
243
|
+
* - `graphics.SEMANTIC_TYPE_TEXCOORD`
|
|
244
|
+
* - `graphics.SEMANTIC_TYPE_PAGE_INDEX`
|
|
245
|
+
* - `graphics.SEMANTIC_TYPE_COLOR`
|
|
246
|
+
* - `graphics.SEMANTIC_TYPE_NORMAL`
|
|
247
|
+
* - `graphics.SEMANTIC_TYPE_TANGENT`
|
|
248
|
+
* - `graphics.SEMANTIC_TYPE_WORLD_MATRIX`
|
|
249
|
+
* - `graphics.SEMANTIC_TYPE_NORMAL_MATRIX`
|
|
250
|
+
* - `graphics.SEMANTIC_TYPE_BONE_WEIGHTS`
|
|
251
|
+
* - `graphics.SEMANTIC_TYPE_BONE_INDICES`
|
|
252
|
+
* - `graphics.SEMANTIC_TYPE_TEXTURE_TRANSFORM_2D`
|
|
253
|
+
* - `graphics.SEMANTIC_TYPE_MORPH_TARGET_WEIGHTS`
|
|
254
|
+
* @example
|
|
255
|
+
* ```ts
|
|
256
|
+
* const vertex_attributes = material.get_vertex_attributes(resource.material("/my_material.materialc"));
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
259
|
+
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 }[];
|
|
260
|
+
/**
|
|
261
|
+
* Sets shader constants in a material, if the constants exist.
|
|
262
|
+
*
|
|
263
|
+
* @param path - The path to the resource
|
|
264
|
+
* @param constants - A table keyed by constant name with args tables as values. Constants can be partially updated. Supported entries:
|
|
265
|
+
*
|
|
266
|
+
* `type`
|
|
267
|
+
* number the type of the constant. Supported values:
|
|
268
|
+
*
|
|
269
|
+
* - `material.CONSTANT_TYPE_USER`
|
|
270
|
+
* - `material.CONSTANT_TYPE_USER_MATRIX4`
|
|
271
|
+
* - `material.CONSTANT_TYPE_VIEWPROJ`
|
|
272
|
+
* - `material.CONSTANT_TYPE_WORLD`
|
|
273
|
+
* - `material.CONSTANT_TYPE_TEXTURE`
|
|
274
|
+
* - `material.CONSTANT_TYPE_VIEW`
|
|
275
|
+
* - `material.CONSTANT_TYPE_PROJECTION`
|
|
276
|
+
* - `material.CONSTANT_TYPE_NORMAL`
|
|
277
|
+
* - `material.CONSTANT_TYPE_WORLDVIEW`
|
|
278
|
+
* - `material.CONSTANT_TYPE_WORLDVIEWPROJ`
|
|
279
|
+
* - `material.CONSTANT_TYPE_TIME`
|
|
280
|
+
* - `material.CONSTANT_TYPE_WORLD_INVERSE`
|
|
281
|
+
* - `material.CONSTANT_TYPE_VIEW_INVERSE`
|
|
282
|
+
* - `material.CONSTANT_TYPE_PROJECTION_INVERSE`
|
|
283
|
+
* - `material.CONSTANT_TYPE_VIEWPROJ_INVERSE`
|
|
284
|
+
* - `material.CONSTANT_TYPE_WORLDVIEW_INVERSE`
|
|
285
|
+
* - `material.CONSTANT_TYPE_WORLDVIEWPROJ_INVERSE`
|
|
286
|
+
*
|
|
287
|
+
* `value`
|
|
288
|
+
* 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.
|
|
289
|
+
* @example
|
|
290
|
+
* ```ts
|
|
291
|
+
* material.set_constants(resource.material("/my_material.materialc"), { tint: { value: vmath.vector4(1, 0, 0, 1) } });
|
|
292
|
+
* ```
|
|
293
|
+
*/
|
|
294
|
+
function set_constants(path: Hash | string, constants: Record<string, { type?: number; value?: Vector4 | Vector3 | Matrix4 | number | (Vector4 | Matrix4)[] }>): void;
|
|
295
|
+
/**
|
|
296
|
+
* Sets texture samplers in a material, if the samplers exist. Use this function to change the settings of texture samplers.
|
|
297
|
+
* To set actual textures that should be bound to the samplers, use the `material.set_textures` function instead.
|
|
298
|
+
*
|
|
299
|
+
* @param path - The path to the resource
|
|
300
|
+
* @param samplers - A table keyed by sampler name with args tables as values. Partial updates are supported. Supported entries:
|
|
301
|
+
*
|
|
302
|
+
* `u_wrap`
|
|
303
|
+
* number the u wrap mode of the texture sampler. Supported values:
|
|
304
|
+
*
|
|
305
|
+
* - `graphics.TEXTURE_WRAP_CLAMP_TO_BORDER`
|
|
306
|
+
* - `graphics.TEXTURE_WRAP_CLAMP_TO_EDGE`
|
|
307
|
+
* - `graphics.TEXTURE_WRAP_MIRRORED_REPEAT`
|
|
308
|
+
* - `graphics.TEXTURE_WRAP_REPEAT`
|
|
309
|
+
*
|
|
310
|
+
* `v_wrap`
|
|
311
|
+
* number the v wrap mode of the texture sampler. Supported values:
|
|
312
|
+
*
|
|
313
|
+
* - `graphics.TEXTURE_WRAP_CLAMP_TO_BORDER`
|
|
314
|
+
* - `graphics.TEXTURE_WRAP_CLAMP_TO_EDGE`
|
|
315
|
+
* - `graphics.TEXTURE_WRAP_MIRRORED_REPEAT`
|
|
316
|
+
* - `graphics.TEXTURE_WRAP_REPEAT`
|
|
317
|
+
*
|
|
318
|
+
* `min_filter`
|
|
319
|
+
* number the min filter mode of the texture sampler. Supported values:
|
|
320
|
+
*
|
|
321
|
+
* - `graphics.TEXTURE_FILTER_DEFAULT`
|
|
322
|
+
* - `graphics.TEXTURE_FILTER_NEAREST`
|
|
323
|
+
* - `graphics.TEXTURE_FILTER_LINEAR`
|
|
324
|
+
* - `graphics.TEXTURE_FILTER_NEAREST_MIPMAP_NEAREST`
|
|
325
|
+
* - `graphics.TEXTURE_FILTER_NEAREST_MIPMAP_LINEAR`
|
|
326
|
+
* - `graphics.TEXTURE_FILTER_LINEAR_MIPMAP_NEAREST`
|
|
327
|
+
* - `graphics.TEXTURE_FILTER_LINEAR_MIPMAP_LINEAR`
|
|
328
|
+
*
|
|
329
|
+
* `mag_filter`
|
|
330
|
+
* number the mag filter mode of the texture sampler
|
|
331
|
+
*
|
|
332
|
+
* - `graphics.TEXTURE_FILTER_DEFAULT`
|
|
333
|
+
* - `graphics.TEXTURE_FILTER_NEAREST`
|
|
334
|
+
* - `graphics.TEXTURE_FILTER_LINEAR`
|
|
335
|
+
*
|
|
336
|
+
* `max_anisotropy`
|
|
337
|
+
* number the max anisotropy of the texture sampler
|
|
338
|
+
* @example
|
|
339
|
+
* ```ts
|
|
340
|
+
* material.set_samplers(resource.material("/my_material.materialc"), { texture_sampler: { u_wrap: graphics.TEXTURE_WRAP_REPEAT, v_wrap: graphics.TEXTURE_WRAP_MIRRORED_REPEAT } });
|
|
341
|
+
* ```
|
|
342
|
+
*/
|
|
343
|
+
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;
|
|
344
|
+
/**
|
|
345
|
+
* Sets textures in a material, if the samplers exist.
|
|
346
|
+
*
|
|
347
|
+
* @param path - The path to the resource
|
|
348
|
+
* @param textures - A table keyed by sampler name with texture resources as values.
|
|
349
|
+
* @example
|
|
350
|
+
* ```ts
|
|
351
|
+
* material.set_textures(resource.material("/my_material.materialc"), { my_texture: resource.texture() });
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
function set_textures(path: Hash | string, textures: LuaMap<string, Hash> | Record<string, Hash>): void;
|
|
355
|
+
/**
|
|
356
|
+
* Sets vertex attributes in a material, if the vertex attributes exist.
|
|
357
|
+
*
|
|
358
|
+
* @param path - The path to the resource
|
|
359
|
+
* @param attributes - A table keyed by vertex attribute name with args tables as values. Partial updates are supported. Supported entries:
|
|
360
|
+
*
|
|
361
|
+
* `value`
|
|
362
|
+
* 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`.
|
|
363
|
+
* `normalize`
|
|
364
|
+
* boolean whether the value is normalized when passed into the shader
|
|
365
|
+
* `data_type`
|
|
366
|
+
* number the data type of the vertex attribute. Supported values:
|
|
367
|
+
*
|
|
368
|
+
* - `graphics.DATA_TYPE_BYTE`
|
|
369
|
+
* - `graphics.DATA_TYPE_UNSIGNED_BYTE`
|
|
370
|
+
* - `graphics.DATA_TYPE_SHORT`
|
|
371
|
+
* - `graphics.DATA_TYPE_UNSIGNED_SHORT`
|
|
372
|
+
* - `graphics.DATA_TYPE_INT`
|
|
373
|
+
* - `graphics.DATA_TYPE_UNSIGNED_INT`
|
|
374
|
+
* - `graphics.DATA_TYPE_FLOAT`
|
|
375
|
+
*
|
|
376
|
+
* `coordinate_space`
|
|
377
|
+
* number the coordinate space of the vertex attribute. Supported values:
|
|
378
|
+
*
|
|
379
|
+
* - `graphics.COORDINATE_SPACE_DEFAULT`
|
|
380
|
+
* - `graphics.COORDINATE_SPACE_WORLD`
|
|
381
|
+
* - `graphics.COORDINATE_SPACE_LOCAL`
|
|
382
|
+
*
|
|
383
|
+
* `semantic_type`
|
|
384
|
+
* number the semantic type of the vertex attribute. Supported values:
|
|
385
|
+
*
|
|
386
|
+
* - `graphics.SEMANTIC_TYPE_NONE`
|
|
387
|
+
* - `graphics.SEMANTIC_TYPE_POSITION`
|
|
388
|
+
* - `graphics.SEMANTIC_TYPE_TEXCOORD`
|
|
389
|
+
* - `graphics.SEMANTIC_TYPE_PAGE_INDEX`
|
|
390
|
+
* - `graphics.SEMANTIC_TYPE_COLOR`
|
|
391
|
+
* - `graphics.SEMANTIC_TYPE_NORMAL`
|
|
392
|
+
* - `graphics.SEMANTIC_TYPE_TANGENT`
|
|
393
|
+
* - `graphics.SEMANTIC_TYPE_WORLD_MATRIX`
|
|
394
|
+
* - `graphics.SEMANTIC_TYPE_NORMAL_MATRIX`
|
|
395
|
+
* - `graphics.SEMANTIC_TYPE_BONE_WEIGHTS`
|
|
396
|
+
* - `graphics.SEMANTIC_TYPE_BONE_INDICES`
|
|
397
|
+
* - `graphics.SEMANTIC_TYPE_TEXTURE_TRANSFORM_2D`
|
|
398
|
+
* - `graphics.SEMANTIC_TYPE_MORPH_TARGET_WEIGHTS`
|
|
399
|
+
* @example
|
|
400
|
+
* ```ts
|
|
401
|
+
* material.set_vertex_attributes(resource.material("/my_material.materialc"), { tint_attribute: { value: vmath.vector4(1, 0, 0, 1), semantic_type: graphics.SEMANTIC_TYPE_COLOR } });
|
|
402
|
+
* ```
|
|
403
|
+
*/
|
|
404
|
+
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;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
export {};
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import type { Hash, Url, Vector3 } from "../../../src/core-types";
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
/**
|
|
6
|
+
* Model API documentation
|
|
7
|
+
*/
|
|
8
|
+
namespace model {
|
|
9
|
+
/**
|
|
10
|
+
* Cancels all animation on a model component.
|
|
11
|
+
*
|
|
12
|
+
* @param url - the model for which to cancel the animation
|
|
13
|
+
*/
|
|
14
|
+
function cancel(url: string | Hash | Url): void;
|
|
15
|
+
/**
|
|
16
|
+
* Get AABB of the whole model in local coordinate space.
|
|
17
|
+
* AABB information return as a table with `min` and `max` fields, where `min` and `max` has type `vmath.vector3`.
|
|
18
|
+
*
|
|
19
|
+
* @param url - the model
|
|
20
|
+
* @returns A table containing AABB of the model. If model has no meshes - return vmath.vector3(0,0,0) for min and max fields.
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* model.get_aabb("#model"); // => { min = vmath.vector3(-2.5, -3.0, 0), max = vmath.vector3(1.5, 5.5, 0) }
|
|
24
|
+
* model.get_aabb("#empty"); // => { min = vmath.vector3(0, 0, 0), max = vmath.vector3(0, 0, 0) }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
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[];
|
|
43
|
+
/**
|
|
44
|
+
* Gets the id of the game object that corresponds to a model skeleton bone.
|
|
45
|
+
* The returned game object can be used for parenting and transform queries.
|
|
46
|
+
* This function has complexity `O(n)`, where `n` is the number of bones in the model skeleton.
|
|
47
|
+
* Game objects corresponding to a model skeleton bone can not be individually deleted.
|
|
48
|
+
*
|
|
49
|
+
* @param url - the model to query
|
|
50
|
+
* @param bone_id - id of the corresponding bone
|
|
51
|
+
* @returns id of the game object
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* // The following examples assume that the model component has id "model".
|
|
55
|
+
* // How to parent the game object of the calling script to the "right_hand" bone
|
|
56
|
+
* // of the model in a player game object:
|
|
57
|
+
* export default defineScript({
|
|
58
|
+
* init(self) {
|
|
59
|
+
* const parent = model.get_go("player#model", "right_hand");
|
|
60
|
+
* msg.post(".", "set_parent", { parent_id: parent });
|
|
61
|
+
* },
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
function get_go(url: string | Hash | Url, bone_id: string | Hash): Hash;
|
|
66
|
+
/**
|
|
67
|
+
* Get AABB of all meshes.
|
|
68
|
+
* AABB information return as a table with `min` and `max` fields, where `min` and `max` has type `vmath.vector3`.
|
|
69
|
+
*
|
|
70
|
+
* @param url - the model
|
|
71
|
+
* @returns A table containing info about all AABB in the format
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* model.get_mesh_aabb("#model"); // => { hash("Sword") = { min = vmath.vector3(-0.5, -0.5, 0), max = vmath.vector3(0.5, 0.5, 0) }, hash("Shield") = { min = vmath.vector3(-0.5, -0.5, -0.5), max = vmath.vector3(0.5, 0.5, 0.5) } }
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
function get_mesh_aabb(url: string | Hash | Url): LuaMap<Hash, { min: Vector3; max: Vector3 }>;
|
|
78
|
+
/**
|
|
79
|
+
* Get the enabled state of a mesh
|
|
80
|
+
*
|
|
81
|
+
* @param url - the model
|
|
82
|
+
* @param mesh_id - the id of the mesh
|
|
83
|
+
* @returns true if the mesh is visible, false otherwise
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* // shared weapon data, e.g. required from your own module
|
|
87
|
+
* const game = { data: { weapons: { Sword: { damage: 10 } } } };
|
|
88
|
+
*
|
|
89
|
+
* export default defineScript({
|
|
90
|
+
* init() {
|
|
91
|
+
* if (model.get_mesh_enabled("#model", "Sword")) {
|
|
92
|
+
* // set properties specific for the sword
|
|
93
|
+
* return { weapon_properties: game.data.weapons["Sword"] };
|
|
94
|
+
* }
|
|
95
|
+
* return { weapon_properties: undefined };
|
|
96
|
+
* },
|
|
97
|
+
* });
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
function get_mesh_enabled(url: string | Hash | Url, mesh_id: string | Hash): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Plays an animation on a model component with specified playback
|
|
103
|
+
* mode and parameters.
|
|
104
|
+
* An optional completion callback function can be provided that will be called when
|
|
105
|
+
* the animation has completed playing. If no function is provided,
|
|
106
|
+
* a model_animation_done message is sent to the script that started the animation.
|
|
107
|
+
* The callback is not called (or message sent) if the animation is
|
|
108
|
+
* cancelled with model.cancel. The callback is called (or message sent) only for
|
|
109
|
+
* animations that play with the following playback modes:
|
|
110
|
+
*
|
|
111
|
+
* - `go.PLAYBACK_ONCE_FORWARD`
|
|
112
|
+
* - `go.PLAYBACK_ONCE_BACKWARD`
|
|
113
|
+
* - `go.PLAYBACK_ONCE_PINGPONG`
|
|
114
|
+
*
|
|
115
|
+
* @param url - the model for which to play the animation
|
|
116
|
+
* @param anim_id - id of the animation to play
|
|
117
|
+
* @param playback - playback mode of the animation
|
|
118
|
+
*
|
|
119
|
+
* - `go.PLAYBACK_ONCE_FORWARD`
|
|
120
|
+
* - `go.PLAYBACK_ONCE_BACKWARD`
|
|
121
|
+
* - `go.PLAYBACK_ONCE_PINGPONG`
|
|
122
|
+
* - `go.PLAYBACK_LOOP_FORWARD`
|
|
123
|
+
* - `go.PLAYBACK_LOOP_BACKWARD`
|
|
124
|
+
* - `go.PLAYBACK_LOOP_PINGPONG`
|
|
125
|
+
* @param play_properties - optional table with properties
|
|
126
|
+
* Play properties table:
|
|
127
|
+
*
|
|
128
|
+
* `blend_duration`
|
|
129
|
+
* number Duration of a linear blend between the current and new animation.
|
|
130
|
+
* `offset`
|
|
131
|
+
* number The normalized initial value of the animation cursor when the animation starts playing.
|
|
132
|
+
* `playback_rate`
|
|
133
|
+
* number The rate with which the animation will be played. Must be positive.
|
|
134
|
+
* @param complete_function - function to call when the animation has completed.
|
|
135
|
+
*
|
|
136
|
+
* `self`
|
|
137
|
+
* object The current object.
|
|
138
|
+
* `message_id`
|
|
139
|
+
* hash The name of the completion message, `"model_animation_done"`.
|
|
140
|
+
* `message`
|
|
141
|
+
* table Information about the completion:
|
|
142
|
+
*
|
|
143
|
+
* - hash `animation_id` - the animation that was completed.
|
|
144
|
+
* - constant `playback` - the playback mode for the animation.
|
|
145
|
+
*
|
|
146
|
+
* `sender`
|
|
147
|
+
* url The invoker of the callback: the model component.
|
|
148
|
+
* @example
|
|
149
|
+
* ```ts
|
|
150
|
+
* // The following examples assume that the model has id "model".
|
|
151
|
+
* // How to play the "jump" animation followed by the "run" animation:
|
|
152
|
+
* const url = msg.url("#model");
|
|
153
|
+
*
|
|
154
|
+
* function anim_done(self: unknown, message_id: unknown, message: unknown, sender: unknown) {
|
|
155
|
+
* if (message_id === hash("model_animation_done")) {
|
|
156
|
+
* const { animation_id } = message as { animation_id: Hash };
|
|
157
|
+
* if (animation_id === hash("jump")) {
|
|
158
|
+
* // open animation done, chain with "run"
|
|
159
|
+
* const properties = { blend_duration: 0.2 };
|
|
160
|
+
* model.play_anim(url, "run", go.PLAYBACK_LOOP_FORWARD, properties, anim_done);
|
|
161
|
+
* }
|
|
162
|
+
* }
|
|
163
|
+
* }
|
|
164
|
+
*
|
|
165
|
+
* export default defineScript({
|
|
166
|
+
* init(self) {
|
|
167
|
+
* const play_properties = { blend_duration: 0.1 };
|
|
168
|
+
* // first blend during 0.1 sec into the jump, then during 0.2 s into the run animation
|
|
169
|
+
* model.play_anim(url, "jump", go.PLAYBACK_ONCE_FORWARD, play_properties, anim_done);
|
|
170
|
+
* },
|
|
171
|
+
* });
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
function play_anim(url: string | Hash | Url, anim_id: string | Hash, playback: go.Playback, play_properties?: { blend_duration?: number; offset?: number; playback_rate?: number }, complete_function?: (self: unknown, message_id: unknown, message: unknown, sender: unknown) => void): void;
|
|
175
|
+
/**
|
|
176
|
+
* Resets a shader constant for a model component.
|
|
177
|
+
* The constant must be defined in the material assigned to the model.
|
|
178
|
+
* Resetting a constant through this function implies that the value defined in the material will be used.
|
|
179
|
+
* Which model to reset a constant for is identified by the URL.
|
|
180
|
+
*
|
|
181
|
+
* @param url - the model that should have a constant reset.
|
|
182
|
+
* @param constant - name of the constant.
|
|
183
|
+
* @example
|
|
184
|
+
* ```ts
|
|
185
|
+
* model.reset_constant("#model", "tint");
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
function reset_constant(url: string | Hash | Url, constant: string | Hash): void;
|
|
189
|
+
/**
|
|
190
|
+
* Copies numeric values from `weights` into each morph target slot for every mesh on the model that has morph targets.
|
|
191
|
+
* At most as many weights are applied as each mesh has morph targets; extra entries in the table are ignored.
|
|
192
|
+
* Missing weights leave the tail zero-filled for meshes with more targets than entries.
|
|
193
|
+
* The override is re-applied every frame after animations run, until cleared by omitting `weights` or passing `nil`.
|
|
194
|
+
* To reset the weights, use `model.set_blend_weights(url)` or `model.set_blend_weights(url, nil)`.
|
|
195
|
+
*
|
|
196
|
+
* @param url - the model component
|
|
197
|
+
* @param weights - array of weight values (1-based indices). Omit or pass `nil` to clear the override and return morphs to animation only
|
|
198
|
+
* @example
|
|
199
|
+
* ```ts
|
|
200
|
+
* model.set_blend_weights("#model", [0, 1, 0.5, 0]);
|
|
201
|
+
* model.set_blend_weights("#model");
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
function set_blend_weights(url: string | Hash | Url, weights?: number[]): void;
|
|
205
|
+
/**
|
|
206
|
+
* Enable or disable visibility of a mesh
|
|
207
|
+
*
|
|
208
|
+
* @param url - the model
|
|
209
|
+
* @param mesh_id - the id of the mesh
|
|
210
|
+
* @param enabled - true if the mesh should be visible, false if it should be hideen
|
|
211
|
+
* @example
|
|
212
|
+
* ```ts
|
|
213
|
+
* export default defineScript({
|
|
214
|
+
* init(self) {
|
|
215
|
+
* model.set_mesh_enabled("#model", "Sword", false); // hide the sword
|
|
216
|
+
* model.set_mesh_enabled("#model", "Axe", true); // show the axe
|
|
217
|
+
* },
|
|
218
|
+
* });
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
function set_mesh_enabled(url: string | Hash | Url, mesh_id: string | Hash, enabled: boolean): void;
|
|
222
|
+
interface properties {
|
|
223
|
+
/**
|
|
224
|
+
* The current animation set on the component. The type of the property is hash.
|
|
225
|
+
*/
|
|
226
|
+
animation: Hash;
|
|
227
|
+
/**
|
|
228
|
+
* The normalized animation cursor. The type of the property is number.
|
|
229
|
+
* Please note that model events may not fire as expected when the cursor is manipulated directly.
|
|
230
|
+
*/
|
|
231
|
+
cursor: number;
|
|
232
|
+
/**
|
|
233
|
+
* The animation playback rate. A multiplier to the animation playback rate. The type of the property is number.
|
|
234
|
+
*/
|
|
235
|
+
playback_rate: number;
|
|
236
|
+
/**
|
|
237
|
+
* The texture hash id of the model. Used for getting/setting model texture for unit 0-7
|
|
238
|
+
*/
|
|
239
|
+
texture0: Hash;
|
|
240
|
+
/**
|
|
241
|
+
* The texture hash id of the model. Used for getting/setting model texture for unit 0-7
|
|
242
|
+
*/
|
|
243
|
+
texture1: Hash;
|
|
244
|
+
/**
|
|
245
|
+
* The texture hash id of the model. Used for getting/setting model texture for unit 0-7
|
|
246
|
+
*/
|
|
247
|
+
texture2: Hash;
|
|
248
|
+
/**
|
|
249
|
+
* The texture hash id of the model. Used for getting/setting model texture for unit 0-7
|
|
250
|
+
*/
|
|
251
|
+
texture3: Hash;
|
|
252
|
+
/**
|
|
253
|
+
* The texture hash id of the model. Used for getting/setting model texture for unit 0-7
|
|
254
|
+
*/
|
|
255
|
+
texture4: Hash;
|
|
256
|
+
/**
|
|
257
|
+
* The texture hash id of the model. Used for getting/setting model texture for unit 0-7
|
|
258
|
+
*/
|
|
259
|
+
texture5: Hash;
|
|
260
|
+
/**
|
|
261
|
+
* The texture hash id of the model. Used for getting/setting model texture for unit 0-7
|
|
262
|
+
*/
|
|
263
|
+
texture6: Hash;
|
|
264
|
+
/**
|
|
265
|
+
* The texture hash id of the model. Used for getting/setting model texture for unit 0-7
|
|
266
|
+
*/
|
|
267
|
+
texture7: Hash;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export {};
|