@defold-typescript/types 0.49.0 → 0.50.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 +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,1153 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import type { Hash, Matrix4, Opaque, Url, Vector4 } from "../../../src/core-types";
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
/**
|
|
6
|
+
* Rendering API documentation
|
|
7
|
+
*/
|
|
8
|
+
namespace render {
|
|
9
|
+
/**
|
|
10
|
+
* Render-camera options
|
|
11
|
+
*/
|
|
12
|
+
interface camera_options {
|
|
13
|
+
/**
|
|
14
|
+
* Use the camera view-projection matrix for frustum culling. The default is false.
|
|
15
|
+
*/
|
|
16
|
+
use_frustum?: boolean;
|
|
17
|
+
}
|
|
18
|
+
type constant_buffer = Opaque<"constant_buffer"> & { [name: string]: Vector4 | Matrix4 | Vector4[] | Matrix4[] };
|
|
19
|
+
/**
|
|
20
|
+
* Debug-draw options
|
|
21
|
+
*/
|
|
22
|
+
interface debug_draw_options {
|
|
23
|
+
/**
|
|
24
|
+
* Frustum matrix used for culling renderable items.
|
|
25
|
+
*/
|
|
26
|
+
frustum?: Matrix4;
|
|
27
|
+
/**
|
|
28
|
+
* Frustum planes used for culling. The default is render.FRUSTUM_PLANES_SIDES.
|
|
29
|
+
*/
|
|
30
|
+
frustum_planes?: render.FRUSTUM_PLANES;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Compute-dispatch options
|
|
34
|
+
*/
|
|
35
|
+
interface dispatch_options {
|
|
36
|
+
/**
|
|
37
|
+
* Constants used by the compute program. The values are copied when `render.dispatch_compute()` is called.
|
|
38
|
+
*/
|
|
39
|
+
constants?: Opaque<"constant_buffer"> & { [name: string]: Vector4 | Matrix4 | Vector4[] | Matrix4[] };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Render draw options
|
|
43
|
+
*/
|
|
44
|
+
interface draw_options {
|
|
45
|
+
/**
|
|
46
|
+
* Frustum matrix used for culling renderable items.
|
|
47
|
+
*/
|
|
48
|
+
frustum?: Matrix4;
|
|
49
|
+
/**
|
|
50
|
+
* Frustum planes used for culling. The default is render.FRUSTUM_PLANES_SIDES.
|
|
51
|
+
*/
|
|
52
|
+
frustum_planes?: render.FRUSTUM_PLANES;
|
|
53
|
+
/**
|
|
54
|
+
* Constants used while rendering. The values are copied when `render.draw()` is called.
|
|
55
|
+
*/
|
|
56
|
+
constants?: Opaque<"constant_buffer"> & { [name: string]: Vector4 | Matrix4 | Vector4[] | Matrix4[] };
|
|
57
|
+
/**
|
|
58
|
+
* World-entry sort order. The default is the renderer's preferred back-to-front order.
|
|
59
|
+
*/
|
|
60
|
+
sort_order?: render.SORT;
|
|
61
|
+
}
|
|
62
|
+
type render_predicate = number;
|
|
63
|
+
type render_target = Opaque<"render_target">;
|
|
64
|
+
/**
|
|
65
|
+
* Render-target attachment parameters
|
|
66
|
+
*/
|
|
67
|
+
interface render_target_buffer_params {
|
|
68
|
+
/**
|
|
69
|
+
* Attachment texture format.
|
|
70
|
+
*/
|
|
71
|
+
format: graphics.TEXTURE_FORMAT;
|
|
72
|
+
/**
|
|
73
|
+
* Attachment width.
|
|
74
|
+
*/
|
|
75
|
+
width: number;
|
|
76
|
+
/**
|
|
77
|
+
* Attachment height.
|
|
78
|
+
*/
|
|
79
|
+
height: number;
|
|
80
|
+
/**
|
|
81
|
+
* Minification filter.
|
|
82
|
+
*/
|
|
83
|
+
min_filter?: graphics.TEXTURE_FILTER;
|
|
84
|
+
/**
|
|
85
|
+
* Magnification filter.
|
|
86
|
+
*/
|
|
87
|
+
mag_filter?: graphics.TEXTURE_FILTER;
|
|
88
|
+
/**
|
|
89
|
+
* Horizontal wrap mode.
|
|
90
|
+
*/
|
|
91
|
+
u_wrap?: graphics.TEXTURE_WRAP;
|
|
92
|
+
/**
|
|
93
|
+
* Vertical wrap mode.
|
|
94
|
+
*/
|
|
95
|
+
v_wrap?: graphics.TEXTURE_WRAP;
|
|
96
|
+
/**
|
|
97
|
+
* Depth wrap mode.
|
|
98
|
+
*/
|
|
99
|
+
w_wrap?: graphics.TEXTURE_WRAP;
|
|
100
|
+
/**
|
|
101
|
+
* Attachment creation flags, applicable only to depth and stencil buffers.
|
|
102
|
+
*/
|
|
103
|
+
flags?: render.RENDER_TARGET_FLAG | number;
|
|
104
|
+
}
|
|
105
|
+
type render_target_params = { sample_count?: number } & { [key: number]: render.render_target_buffer_params };
|
|
106
|
+
/**
|
|
107
|
+
* Render-target activation options
|
|
108
|
+
*/
|
|
109
|
+
interface set_render_target_options {
|
|
110
|
+
/**
|
|
111
|
+
* Buffers whose contents become undefined after the target is deactivated. Missing buffers are ignored; combined depth-stencil buffers remain non-transient unless both are selected.
|
|
112
|
+
*/
|
|
113
|
+
transient?: graphics.BUFFER_TYPE[];
|
|
114
|
+
}
|
|
115
|
+
type texture = Opaque<"texture">;
|
|
116
|
+
type ClearBufferKey = typeof graphics.BUFFER_TYPE_COLOR0_BIT | typeof graphics.BUFFER_TYPE_DEPTH_BIT | typeof graphics.BUFFER_TYPE_STENCIL_BIT;
|
|
117
|
+
type CONTEXT_EVENT = typeof render.CONTEXT_EVENT_CONTEXT_LOST | typeof render.CONTEXT_EVENT_CONTEXT_RESTORED;
|
|
118
|
+
type FRUSTUM_PLANES = typeof render.FRUSTUM_PLANES_ALL | typeof render.FRUSTUM_PLANES_SIDES;
|
|
119
|
+
type RENDER_TARGET_FLAG = typeof render.TEXTURE_BIT;
|
|
120
|
+
type SORT = typeof render.SORT_BACK_TO_FRONT | typeof render.SORT_FRONT_TO_BACK | typeof render.SORT_NONE;
|
|
121
|
+
/**
|
|
122
|
+
* rendering context was lost; rendering pauses and graphics resources become invalid
|
|
123
|
+
*/
|
|
124
|
+
const CONTEXT_EVENT_CONTEXT_LOST: number & { readonly __brand: "render.CONTEXT_EVENT_CONTEXT_LOST" };
|
|
125
|
+
/**
|
|
126
|
+
* rendering context was restored; rendering remains paused while resources can be reloaded
|
|
127
|
+
*/
|
|
128
|
+
const CONTEXT_EVENT_CONTEXT_RESTORED: number & { readonly __brand: "render.CONTEXT_EVENT_CONTEXT_RESTORED" };
|
|
129
|
+
/**
|
|
130
|
+
* All six frustum planes.
|
|
131
|
+
*/
|
|
132
|
+
const FRUSTUM_PLANES_ALL: number & { readonly __brand: "render.FRUSTUM_PLANES_ALL" };
|
|
133
|
+
/**
|
|
134
|
+
* Left, right, top, and bottom frustum planes.
|
|
135
|
+
*/
|
|
136
|
+
const FRUSTUM_PLANES_SIDES: number & { readonly __brand: "render.FRUSTUM_PLANES_SIDES" };
|
|
137
|
+
const RENDER_TARGET_DEFAULT: undefined;
|
|
138
|
+
/**
|
|
139
|
+
* Depth sort far-to-near (default; good for transparent passes).
|
|
140
|
+
*/
|
|
141
|
+
const SORT_BACK_TO_FRONT: number & { readonly __brand: "render.SORT_BACK_TO_FRONT" };
|
|
142
|
+
/**
|
|
143
|
+
* Depth sort near-to-far (good for opaque passes to reduce overdraw).
|
|
144
|
+
*/
|
|
145
|
+
const SORT_FRONT_TO_BACK: number & { readonly __brand: "render.SORT_FRONT_TO_BACK" };
|
|
146
|
+
/**
|
|
147
|
+
* No per-call sorting; draw entries in insertion order.
|
|
148
|
+
*/
|
|
149
|
+
const SORT_NONE: number & { readonly __brand: "render.SORT_NONE" };
|
|
150
|
+
/**
|
|
151
|
+
* Create a texture-backed depth or stencil attachment.
|
|
152
|
+
*/
|
|
153
|
+
const TEXTURE_BIT: number & { readonly __brand: "render.TEXTURE_BIT" };
|
|
154
|
+
/**
|
|
155
|
+
* Clear buffers in the currently enabled render target with specified value. If the render target has been created with multiple
|
|
156
|
+
* color attachments, all buffers will be cleared with the same value.
|
|
157
|
+
*
|
|
158
|
+
* @param buffers - table with keys specifying which buffers to clear and values set to clear values. Available keys are:
|
|
159
|
+
*
|
|
160
|
+
* - `graphics.BUFFER_TYPE_COLOR0_BIT`
|
|
161
|
+
* - `graphics.BUFFER_TYPE_DEPTH_BIT`
|
|
162
|
+
* - `graphics.BUFFER_TYPE_STENCIL_BIT`
|
|
163
|
+
* @example
|
|
164
|
+
* ```ts
|
|
165
|
+
* // Clear the color buffer and the depth buffer.
|
|
166
|
+
* const buffers = new LuaMap<render.ClearBufferKey, number | Vector4>();
|
|
167
|
+
* buffers.set(graphics.BUFFER_TYPE_COLOR0_BIT, vmath.vector4(0, 0, 0, 0));
|
|
168
|
+
* buffers.set(graphics.BUFFER_TYPE_DEPTH_BIT, 1);
|
|
169
|
+
* render.clear(buffers);
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
function clear(buffers: LuaMap<render.ClearBufferKey, number | Vector4>): void;
|
|
173
|
+
/**
|
|
174
|
+
* Constant buffers are used to set shader program variables and are optionally passed to the `render.draw()` function.
|
|
175
|
+
* The buffer's constant elements can be indexed like an ordinary Lua table, but you can't iterate over them with pairs() or ipairs().
|
|
176
|
+
*
|
|
177
|
+
* @returns new constant buffer
|
|
178
|
+
* @example
|
|
179
|
+
* Set a "tint" constant in a constant buffer in the render script:
|
|
180
|
+
* ```ts
|
|
181
|
+
* const constants = render.constant_buffer();
|
|
182
|
+
* constants.tint = vmath.vector4(1, 1, 1, 1);
|
|
183
|
+
* ```
|
|
184
|
+
* @example
|
|
185
|
+
* Then use the constant buffer when drawing a predicate:
|
|
186
|
+
* ```ts
|
|
187
|
+
* export default defineRenderScript({
|
|
188
|
+
* init() {
|
|
189
|
+
* return { my_pred: render.predicate([hash("my_tag")]) };
|
|
190
|
+
* },
|
|
191
|
+
*
|
|
192
|
+
* update(self, dt) {
|
|
193
|
+
* const constants = render.constant_buffer();
|
|
194
|
+
* render.draw(self.my_pred, { constants });
|
|
195
|
+
* },
|
|
196
|
+
* });
|
|
197
|
+
* ```
|
|
198
|
+
* @example
|
|
199
|
+
* The constant buffer also supports array values by specifying constants in a table:
|
|
200
|
+
* ```ts
|
|
201
|
+
* const constants = render.constant_buffer();
|
|
202
|
+
* constants.light_colors = [];
|
|
203
|
+
* constants.light_colors[0] = vmath.vector4(1, 0, 0, 1);
|
|
204
|
+
* constants.light_colors[1] = vmath.vector4(0, 1, 0, 1);
|
|
205
|
+
* constants.light_colors[2] = vmath.vector4(0, 0, 1, 1);
|
|
206
|
+
* ```
|
|
207
|
+
* @example
|
|
208
|
+
* You can also create the table by passing the vectors directly when creating the table:
|
|
209
|
+
* ```ts
|
|
210
|
+
* const constants = render.constant_buffer();
|
|
211
|
+
* constants.light_colors = [
|
|
212
|
+
* vmath.vector4(1, 0, 0, 1),
|
|
213
|
+
* vmath.vector4(0, 1, 0, 1),
|
|
214
|
+
* vmath.vector4(0, 0, 1, 1),
|
|
215
|
+
* ];
|
|
216
|
+
*
|
|
217
|
+
* // Add more constants to the array
|
|
218
|
+
* constants.light_colors[3] = vmath.vector4(1, 1, 1, 1);
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
function constant_buffer(): Opaque<"constant_buffer"> & { [name: string]: Vector4 | Matrix4 | Vector4[] | Matrix4[] };
|
|
222
|
+
/**
|
|
223
|
+
* Deletes a render target created by a render script.
|
|
224
|
+
* You cannot delete a render target resource.
|
|
225
|
+
*
|
|
226
|
+
* @param render_target - render target to delete
|
|
227
|
+
* @example
|
|
228
|
+
* ```ts
|
|
229
|
+
* export default defineRenderScript({
|
|
230
|
+
* init() {
|
|
231
|
+
* return { my_render_target: render.render_target("my_target", {}) };
|
|
232
|
+
* },
|
|
233
|
+
*
|
|
234
|
+
* final(self) {
|
|
235
|
+
* // How to delete a render target:
|
|
236
|
+
* render.delete_render_target(self.my_render_target);
|
|
237
|
+
* },
|
|
238
|
+
* });
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
function delete_render_target(render_target: Opaque<"render_target">): void;
|
|
242
|
+
/**
|
|
243
|
+
* If a material is currently enabled, disable it.
|
|
244
|
+
* The name of the material must be specified in the ".render" resource set
|
|
245
|
+
* in the "game.project" setting.
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```ts
|
|
249
|
+
* export default defineRenderScript({
|
|
250
|
+
* init() {
|
|
251
|
+
* return { my_pred: render.predicate([hash("my_tag")]) };
|
|
252
|
+
* },
|
|
253
|
+
*
|
|
254
|
+
* update(self, dt) {
|
|
255
|
+
* // Enable material named "glow", then draw my_pred with it.
|
|
256
|
+
* render.enable_material("glow");
|
|
257
|
+
* render.draw(self.my_pred);
|
|
258
|
+
* render.disable_material();
|
|
259
|
+
* },
|
|
260
|
+
* });
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
function disable_material(): void;
|
|
264
|
+
/**
|
|
265
|
+
* Disables a render state.
|
|
266
|
+
*
|
|
267
|
+
* @param state - state to disable
|
|
268
|
+
*
|
|
269
|
+
* - `graphics.STATE_DEPTH_TEST`
|
|
270
|
+
* - `graphics.STATE_STENCIL_TEST`
|
|
271
|
+
* - `graphics.STATE_BLEND`
|
|
272
|
+
* - `graphics.STATE_ALPHA_TEST` ( not available on iOS and Android)
|
|
273
|
+
* - `graphics.STATE_CULL_FACE`
|
|
274
|
+
* - `graphics.STATE_POLYGON_OFFSET_FILL`
|
|
275
|
+
* @example
|
|
276
|
+
* ```ts
|
|
277
|
+
* export default defineRenderScript({
|
|
278
|
+
* init() {
|
|
279
|
+
* return { tile_pred: render.predicate([hash("tile")]) };
|
|
280
|
+
* },
|
|
281
|
+
*
|
|
282
|
+
* update(self, dt) {
|
|
283
|
+
* // Disable face culling when drawing the tile predicate:
|
|
284
|
+
* render.disable_state(graphics.STATE_CULL_FACE);
|
|
285
|
+
* render.draw(self.tile_pred);
|
|
286
|
+
* },
|
|
287
|
+
* });
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
function disable_state(state: graphics.STATE): void;
|
|
291
|
+
/**
|
|
292
|
+
* Disables a texture that has previourly been enabled.
|
|
293
|
+
*
|
|
294
|
+
* @param binding - texture binding, either by texture unit, string or hash that should be disabled
|
|
295
|
+
* @example
|
|
296
|
+
* ```ts
|
|
297
|
+
* export default defineRenderScript({
|
|
298
|
+
* init() {
|
|
299
|
+
* const color_params = {
|
|
300
|
+
* format: graphics.TEXTURE_FORMAT_RGBA,
|
|
301
|
+
* width: render.get_window_width(),
|
|
302
|
+
* height: render.get_window_height(),
|
|
303
|
+
* };
|
|
304
|
+
* return {
|
|
305
|
+
* my_render_target: render.render_target({ [graphics.BUFFER_TYPE_COLOR0_BIT]: color_params }),
|
|
306
|
+
* my_pred: render.predicate([hash("my_tag")]),
|
|
307
|
+
* };
|
|
308
|
+
* },
|
|
309
|
+
*
|
|
310
|
+
* update(self, dt) {
|
|
311
|
+
* render.enable_texture(0, self.my_render_target, graphics.BUFFER_TYPE_COLOR0_BIT);
|
|
312
|
+
* // draw a predicate with the render target available as texture 0 in the predicate
|
|
313
|
+
* // material shader.
|
|
314
|
+
* render.draw(self.my_pred);
|
|
315
|
+
* // done, disable the texture
|
|
316
|
+
* render.disable_texture(0);
|
|
317
|
+
* },
|
|
318
|
+
* });
|
|
319
|
+
* ```
|
|
320
|
+
*/
|
|
321
|
+
function disable_texture(binding: Opaque<"texture"> | string | Hash | number): void;
|
|
322
|
+
/**
|
|
323
|
+
* Dispatches the currently enabled compute program. The dispatch call takes three arguments x,y,z which constitutes
|
|
324
|
+
* the 'global working group' of the compute dispatch. Together with the 'local working group' specified in the compute shader
|
|
325
|
+
* as a layout qualifier, these two sets of parameters forms the number of invocations the compute shader will execute.
|
|
326
|
+
* An optional constant buffer can be provided to override the default constants. If no constants buffer is provided, a default
|
|
327
|
+
* system constants buffer is used containing constants as defined in the compute program.
|
|
328
|
+
*
|
|
329
|
+
* @param x - global work group size X
|
|
330
|
+
* @param y - global work group size Y
|
|
331
|
+
* @param z - global work group size Z
|
|
332
|
+
* @param options - optional compute-dispatch options
|
|
333
|
+
* @example
|
|
334
|
+
* ```ts
|
|
335
|
+
* export default defineRenderScript({
|
|
336
|
+
* init() {
|
|
337
|
+
* const color_params = {
|
|
338
|
+
* format: graphics.TEXTURE_FORMAT_RGBA,
|
|
339
|
+
* width: render.get_window_width(),
|
|
340
|
+
* height: render.get_window_height(),
|
|
341
|
+
* };
|
|
342
|
+
* return {
|
|
343
|
+
* backing_texture: resource.get_texture_info("/main/backing.texturec").handle,
|
|
344
|
+
* scene_rt: render.render_target({ [graphics.BUFFER_TYPE_COLOR0_BIT]: color_params }),
|
|
345
|
+
* };
|
|
346
|
+
* },
|
|
347
|
+
*
|
|
348
|
+
* update(self, dt) {
|
|
349
|
+
* render.set_compute("bloom");
|
|
350
|
+
* render.enable_texture(0, self.backing_texture);
|
|
351
|
+
* render.enable_texture(1, self.scene_rt);
|
|
352
|
+
* render.dispatch_compute(128, 128, 1);
|
|
353
|
+
* render.set_compute();
|
|
354
|
+
* },
|
|
355
|
+
* });
|
|
356
|
+
* ```
|
|
357
|
+
* @example
|
|
358
|
+
* Dispatch a compute program with a constant buffer:
|
|
359
|
+
* ```ts
|
|
360
|
+
* const constants = render.constant_buffer();
|
|
361
|
+
* constants.tint = vmath.vector4(1, 1, 1, 1);
|
|
362
|
+
* render.dispatch_compute(32, 32, 32, { constants });
|
|
363
|
+
* ```
|
|
364
|
+
*/
|
|
365
|
+
function dispatch_compute(x: number, y: number, z: number, options?: render.dispatch_options): void;
|
|
366
|
+
/**
|
|
367
|
+
* Draws all objects that match a specified predicate. An optional constant buffer can be
|
|
368
|
+
* provided to override the default constants. If no constants buffer is provided, a default
|
|
369
|
+
* system constants buffer is used containing constants as defined in materials and set through
|
|
370
|
+
* go.set (or particlefx.set_constant) on visual components.
|
|
371
|
+
*
|
|
372
|
+
* @param predicate - predicate to draw for
|
|
373
|
+
* @param options - optional draw options
|
|
374
|
+
* @example
|
|
375
|
+
* ```ts
|
|
376
|
+
* export default defineRenderScript({
|
|
377
|
+
* init() {
|
|
378
|
+
* // define a predicate matching anything with material tag "my_tag"
|
|
379
|
+
* return { my_pred: render.predicate([hash("my_tag")]) };
|
|
380
|
+
* },
|
|
381
|
+
*
|
|
382
|
+
* update(self, dt) {
|
|
383
|
+
* // draw everything in the my_pred predicate
|
|
384
|
+
* render.draw(self.my_pred);
|
|
385
|
+
* },
|
|
386
|
+
* });
|
|
387
|
+
* ```
|
|
388
|
+
* @example
|
|
389
|
+
* Draw predicate with constants:
|
|
390
|
+
* ```ts
|
|
391
|
+
* function draw_tinted(self: { my_pred: Opaque<"render_predicate"> }) {
|
|
392
|
+
* const constants = render.constant_buffer();
|
|
393
|
+
* constants.tint = vmath.vector4(1, 1, 1, 1);
|
|
394
|
+
* render.draw(self.my_pred, { constants });
|
|
395
|
+
* }
|
|
396
|
+
* ```
|
|
397
|
+
* @example
|
|
398
|
+
* Draw with predicate and frustum culling (without near+far planes):
|
|
399
|
+
* ```ts
|
|
400
|
+
* function draw_culled(self: { my_pred: Opaque<"render_predicate">; proj: Matrix4; view: Matrix4 }) {
|
|
401
|
+
* const frustum = self.proj.mul(self.view);
|
|
402
|
+
* render.draw(self.my_pred, { frustum });
|
|
403
|
+
* }
|
|
404
|
+
* ```
|
|
405
|
+
* @example
|
|
406
|
+
* Draw with predicate and frustum culling (with near+far planes):
|
|
407
|
+
* ```ts
|
|
408
|
+
* function draw_culled(self: { my_pred: Opaque<"render_predicate">; proj: Matrix4; view: Matrix4 }) {
|
|
409
|
+
* const frustum = self.proj.mul(self.view);
|
|
410
|
+
* render.draw(self.my_pred, { frustum, frustum_planes: render.FRUSTUM_PLANES_ALL });
|
|
411
|
+
* }
|
|
412
|
+
* ```
|
|
413
|
+
*/
|
|
414
|
+
function draw(predicate: Opaque<"render_predicate">, options?: render.draw_options): void;
|
|
415
|
+
/**
|
|
416
|
+
* Draws all 3d debug graphics such as lines drawn with "draw_line" messages and physics visualization.
|
|
417
|
+
*
|
|
418
|
+
* @param options - optional debug-draw options
|
|
419
|
+
* @example
|
|
420
|
+
* ```ts
|
|
421
|
+
* export default defineRenderScript({
|
|
422
|
+
* update(self, dt) {
|
|
423
|
+
* // draw debug visualization
|
|
424
|
+
* render.draw_debug3d();
|
|
425
|
+
* },
|
|
426
|
+
* });
|
|
427
|
+
* ```
|
|
428
|
+
*/
|
|
429
|
+
function draw_debug3d(options?: render.debug_draw_options): void;
|
|
430
|
+
/**
|
|
431
|
+
* If another material was already enabled, it will be automatically disabled
|
|
432
|
+
* and the specified material is used instead.
|
|
433
|
+
* The name of the material must be specified in the ".render" resource set
|
|
434
|
+
* in the "game.project" setting.
|
|
435
|
+
*
|
|
436
|
+
* @param material_id - material id to enable
|
|
437
|
+
* @example
|
|
438
|
+
* ```ts
|
|
439
|
+
* export default defineRenderScript({
|
|
440
|
+
* init() {
|
|
441
|
+
* return { my_pred: render.predicate([hash("my_tag")]) };
|
|
442
|
+
* },
|
|
443
|
+
*
|
|
444
|
+
* update(self, dt) {
|
|
445
|
+
* // Enable material named "glow", then draw my_pred with it.
|
|
446
|
+
* render.enable_material("glow");
|
|
447
|
+
* render.draw(self.my_pred);
|
|
448
|
+
* render.disable_material();
|
|
449
|
+
* },
|
|
450
|
+
* });
|
|
451
|
+
* ```
|
|
452
|
+
*/
|
|
453
|
+
function enable_material(material_id: string | Hash): void;
|
|
454
|
+
/**
|
|
455
|
+
* Enables a particular render state. The state will be enabled until disabled.
|
|
456
|
+
*
|
|
457
|
+
* @param state - state to enable
|
|
458
|
+
*
|
|
459
|
+
* - `graphics.STATE_DEPTH_TEST`
|
|
460
|
+
* - `graphics.STATE_STENCIL_TEST`
|
|
461
|
+
* - `graphics.STATE_BLEND`
|
|
462
|
+
* - `graphics.STATE_ALPHA_TEST` ( not available on iOS and Android)
|
|
463
|
+
* - `graphics.STATE_CULL_FACE`
|
|
464
|
+
* - `graphics.STATE_POLYGON_OFFSET_FILL`
|
|
465
|
+
* @example
|
|
466
|
+
* ```ts
|
|
467
|
+
* export default defineRenderScript({
|
|
468
|
+
* init() {
|
|
469
|
+
* return { gui_pred: render.predicate([hash("gui")]) };
|
|
470
|
+
* },
|
|
471
|
+
*
|
|
472
|
+
* update(self, dt) {
|
|
473
|
+
* // Enable stencil test when drawing the gui predicate, then disable it:
|
|
474
|
+
* render.enable_state(graphics.STATE_STENCIL_TEST);
|
|
475
|
+
* render.draw(self.gui_pred);
|
|
476
|
+
* render.disable_state(graphics.STATE_STENCIL_TEST);
|
|
477
|
+
* },
|
|
478
|
+
* });
|
|
479
|
+
* ```
|
|
480
|
+
*/
|
|
481
|
+
function enable_state(state: graphics.STATE): void;
|
|
482
|
+
/**
|
|
483
|
+
* Sets the specified texture handle for a render target attachment or a regular texture
|
|
484
|
+
* that should be used for rendering. The texture can be bound to either a texture unit
|
|
485
|
+
* or to a sampler name by a hash or a string.
|
|
486
|
+
* A texture can be bound to multiple units and sampler names at the same time,
|
|
487
|
+
* the actual binding will be applied to the shaders when a shader program is bound.
|
|
488
|
+
* When mixing binding using both units and sampler names, you might end up in situations
|
|
489
|
+
* where two different textures will be applied to the same bind location in the shader.
|
|
490
|
+
* In this case, the texture set to the named sampler will take precedence over the unit.
|
|
491
|
+
* Note that you can bind multiple sampler names to the same texture, in case you want to reuse
|
|
492
|
+
* the same texture for differnt use-cases. It is however recommended that you use the same name
|
|
493
|
+
* everywhere for the textures that should be shared across different materials.
|
|
494
|
+
*
|
|
495
|
+
* @param binding - texture binding, either by texture unit, string or hash for the sampler name that the texture should be bound to
|
|
496
|
+
* @param handle_or_name - render target or texture handle that should be bound, or a named resource in the "Render Resource" table in the currently assigned .render file
|
|
497
|
+
* @param buffer_type - optional render-target attachment. Defaults to `graphics.BUFFER_TYPE_COLOR0_BIT`. Depth and stencil attachments must have been created as textures; color attachments beyond the first require a render target with multiple color attachments (up to four are supported).
|
|
498
|
+
* @example
|
|
499
|
+
* ```ts
|
|
500
|
+
* export default defineRenderScript({
|
|
501
|
+
* init() {
|
|
502
|
+
* const color_params = {
|
|
503
|
+
* format: graphics.TEXTURE_FORMAT_RGBA,
|
|
504
|
+
* width: render.get_window_width(),
|
|
505
|
+
* height: render.get_window_height(),
|
|
506
|
+
* };
|
|
507
|
+
* return {
|
|
508
|
+
* my_render_target: render.render_target({ [graphics.BUFFER_TYPE_COLOR0_BIT]: color_params }),
|
|
509
|
+
* my_pred: render.predicate([hash("my_tag")]),
|
|
510
|
+
* };
|
|
511
|
+
* },
|
|
512
|
+
*
|
|
513
|
+
* update(self, dt) {
|
|
514
|
+
* // enable target so all drawing is done to it
|
|
515
|
+
* render.set_render_target(self.my_render_target);
|
|
516
|
+
*
|
|
517
|
+
* // draw a predicate to the render target
|
|
518
|
+
* render.draw(self.my_pred);
|
|
519
|
+
*
|
|
520
|
+
* // disable target
|
|
521
|
+
* render.set_render_target(render.RENDER_TARGET_DEFAULT);
|
|
522
|
+
*
|
|
523
|
+
* render.enable_texture(0, self.my_render_target, graphics.BUFFER_TYPE_COLOR0_BIT);
|
|
524
|
+
* // draw a predicate with the render target available as texture 0 in the predicate
|
|
525
|
+
* // material shader.
|
|
526
|
+
* render.draw(self.my_pred);
|
|
527
|
+
* },
|
|
528
|
+
* });
|
|
529
|
+
* ```
|
|
530
|
+
* @example
|
|
531
|
+
* ```ts
|
|
532
|
+
* export default defineRenderScript({
|
|
533
|
+
* init() {
|
|
534
|
+
* return { my_pred: render.predicate([hash("my_tag")]) };
|
|
535
|
+
* },
|
|
536
|
+
*
|
|
537
|
+
* update(self, dt) {
|
|
538
|
+
* // enable render target by resource id
|
|
539
|
+
* render.set_render_target("my_rt_resource");
|
|
540
|
+
* render.draw(self.my_pred);
|
|
541
|
+
* render.set_render_target(render.RENDER_TARGET_DEFAULT);
|
|
542
|
+
*
|
|
543
|
+
* render.enable_texture(0, "my_rt_resource", graphics.BUFFER_TYPE_COLOR0_BIT);
|
|
544
|
+
* // draw a predicate with the render target available as texture 0 in the predicate
|
|
545
|
+
* // material shader.
|
|
546
|
+
* render.draw(self.my_pred);
|
|
547
|
+
* },
|
|
548
|
+
* });
|
|
549
|
+
* ```
|
|
550
|
+
* @example
|
|
551
|
+
* ```ts
|
|
552
|
+
* export default defineRenderScript({
|
|
553
|
+
* init() {
|
|
554
|
+
* return { my_texture_handle: resource.get_texture_info("/main/my_texture.texturec").handle };
|
|
555
|
+
* },
|
|
556
|
+
*
|
|
557
|
+
* update(self, dt) {
|
|
558
|
+
* // bind a texture to the texture unit 0
|
|
559
|
+
* render.enable_texture(0, self.my_texture_handle);
|
|
560
|
+
* // bind the same texture to a named sampler
|
|
561
|
+
* render.enable_texture("my_texture_sampler", self.my_texture_handle);
|
|
562
|
+
* },
|
|
563
|
+
* });
|
|
564
|
+
* ```
|
|
565
|
+
*/
|
|
566
|
+
function enable_texture(binding: number | string | Hash, handle_or_name: Opaque<"texture"> | string | Hash | Opaque<"render_target"> | number, buffer_type?: graphics.BUFFER_TYPE): void;
|
|
567
|
+
/**
|
|
568
|
+
* Returns the logical window height that is set in the "game.project" settings.
|
|
569
|
+
* Note that the actual window pixel size can change, either by device constraints
|
|
570
|
+
* or user input.
|
|
571
|
+
*
|
|
572
|
+
* @returns specified window height
|
|
573
|
+
* @example
|
|
574
|
+
* ```ts
|
|
575
|
+
* // Get the height of the window
|
|
576
|
+
* const h = render.get_height();
|
|
577
|
+
* ```
|
|
578
|
+
*/
|
|
579
|
+
function get_height(): number;
|
|
580
|
+
/**
|
|
581
|
+
* Returns the specified buffer height from a render target.
|
|
582
|
+
*
|
|
583
|
+
* @param render_target - render target from which to retrieve the buffer height
|
|
584
|
+
* @param buffer_type - which type of buffer to retrieve the height from
|
|
585
|
+
*
|
|
586
|
+
* - `graphics.BUFFER_TYPE_COLOR0_BIT`
|
|
587
|
+
* - `graphics.BUFFER_TYPE_DEPTH_BIT`
|
|
588
|
+
* - `graphics.BUFFER_TYPE_STENCIL_BIT`
|
|
589
|
+
* @returns the height of the render target buffer texture
|
|
590
|
+
* @example
|
|
591
|
+
* ```ts
|
|
592
|
+
* export default defineRenderScript({
|
|
593
|
+
* init() {
|
|
594
|
+
* const color_params = {
|
|
595
|
+
* format: graphics.TEXTURE_FORMAT_RGBA,
|
|
596
|
+
* width: render.get_window_width(),
|
|
597
|
+
* height: render.get_window_height(),
|
|
598
|
+
* };
|
|
599
|
+
* return {
|
|
600
|
+
* target_right: render.render_target("right", {
|
|
601
|
+
* [graphics.BUFFER_TYPE_COLOR0_BIT]: color_params,
|
|
602
|
+
* }),
|
|
603
|
+
* };
|
|
604
|
+
* },
|
|
605
|
+
*
|
|
606
|
+
* update(self, dt) {
|
|
607
|
+
* // get the height of the render target color buffer
|
|
608
|
+
* const h = render.get_render_target_height(self.target_right, graphics.BUFFER_TYPE_COLOR0_BIT);
|
|
609
|
+
* // get the height of a render target resource
|
|
610
|
+
* const w = render.get_render_target_height("my_rt_resource", graphics.BUFFER_TYPE_COLOR0_BIT);
|
|
611
|
+
* },
|
|
612
|
+
* });
|
|
613
|
+
* ```
|
|
614
|
+
*/
|
|
615
|
+
function get_render_target_height(render_target: Opaque<"render_target"> | string | Hash, buffer_type: graphics.BUFFER_TYPE): number;
|
|
616
|
+
/**
|
|
617
|
+
* Returns the specified buffer width from a render target.
|
|
618
|
+
*
|
|
619
|
+
* @param render_target - render target from which to retrieve the buffer width
|
|
620
|
+
* @param buffer_type - which type of buffer to retrieve the width from
|
|
621
|
+
*
|
|
622
|
+
* - `graphics.BUFFER_TYPE_COLOR0_BIT`
|
|
623
|
+
* - `graphics.BUFFER_TYPE_COLOR[x]_BIT` (x: [0..3], if supported!)
|
|
624
|
+
* - `graphics.BUFFER_TYPE_DEPTH_BIT`
|
|
625
|
+
* - `graphics.BUFFER_TYPE_STENCIL_BIT`
|
|
626
|
+
* @returns the width of the render target buffer texture
|
|
627
|
+
* @example
|
|
628
|
+
* ```ts
|
|
629
|
+
* export default defineRenderScript({
|
|
630
|
+
* init() {
|
|
631
|
+
* const color_params = {
|
|
632
|
+
* format: graphics.TEXTURE_FORMAT_RGBA,
|
|
633
|
+
* width: render.get_window_width(),
|
|
634
|
+
* height: render.get_window_height(),
|
|
635
|
+
* };
|
|
636
|
+
* return {
|
|
637
|
+
* target_right: render.render_target("right", {
|
|
638
|
+
* [graphics.BUFFER_TYPE_COLOR0_BIT]: color_params,
|
|
639
|
+
* }),
|
|
640
|
+
* };
|
|
641
|
+
* },
|
|
642
|
+
*
|
|
643
|
+
* update(self, dt) {
|
|
644
|
+
* // get the width of the render target color buffer
|
|
645
|
+
* const w = render.get_render_target_width(self.target_right, graphics.BUFFER_TYPE_COLOR0_BIT);
|
|
646
|
+
* // get the width of a render target resource
|
|
647
|
+
* const w2 = render.get_render_target_width("my_rt_resource", graphics.BUFFER_TYPE_COLOR0_BIT);
|
|
648
|
+
* },
|
|
649
|
+
* });
|
|
650
|
+
* ```
|
|
651
|
+
*/
|
|
652
|
+
function get_render_target_width(render_target: Opaque<"render_target"> | string | Hash, buffer_type: graphics.BUFFER_TYPE): number;
|
|
653
|
+
/**
|
|
654
|
+
* Returns the logical window width that is set in the "game.project" settings.
|
|
655
|
+
* Note that the actual window pixel size can change, either by device constraints
|
|
656
|
+
* or user input.
|
|
657
|
+
*
|
|
658
|
+
* @returns specified window width
|
|
659
|
+
* @example
|
|
660
|
+
* ```ts
|
|
661
|
+
* // Get the width of the window.
|
|
662
|
+
* const w = render.get_width();
|
|
663
|
+
* ```
|
|
664
|
+
*/
|
|
665
|
+
function get_width(): number;
|
|
666
|
+
/**
|
|
667
|
+
* Returns the actual physical window height.
|
|
668
|
+
* Note that this value might differ from the logical height that is set in the
|
|
669
|
+
* "game.project" settings.
|
|
670
|
+
*
|
|
671
|
+
* @returns actual window height
|
|
672
|
+
* @example
|
|
673
|
+
* ```ts
|
|
674
|
+
* // Get the actual height of the window
|
|
675
|
+
* const h = render.get_window_height();
|
|
676
|
+
* ```
|
|
677
|
+
*/
|
|
678
|
+
function get_window_height(): number;
|
|
679
|
+
/**
|
|
680
|
+
* Returns the actual physical window width.
|
|
681
|
+
* Note that this value might differ from the logical width that is set in the
|
|
682
|
+
* "game.project" settings.
|
|
683
|
+
*
|
|
684
|
+
* @returns actual window width
|
|
685
|
+
* @example
|
|
686
|
+
* ```ts
|
|
687
|
+
* // Get the actual width of the window
|
|
688
|
+
* const w = render.get_window_width();
|
|
689
|
+
* ```
|
|
690
|
+
*/
|
|
691
|
+
function get_window_width(): number;
|
|
692
|
+
/**
|
|
693
|
+
* This function returns a new render predicate for objects with materials matching
|
|
694
|
+
* the provided material tags. The provided tags are combined into a bit mask
|
|
695
|
+
* for the predicate. If multiple tags are provided, the predicate matches materials
|
|
696
|
+
* with all tags ANDed together.
|
|
697
|
+
* The current limit to the number of tags that can be defined is `64`.
|
|
698
|
+
*
|
|
699
|
+
* @param tags - table of tags that the predicate should match. The tags can be of either hash or string type
|
|
700
|
+
* @returns new predicate
|
|
701
|
+
* @example
|
|
702
|
+
* ```ts
|
|
703
|
+
* // Create a new render predicate containing all visual objects that
|
|
704
|
+
* // have a material with material tags "opaque" AND "smoke".
|
|
705
|
+
* const p = render.predicate([hash("opaque"), hash("smoke")]);
|
|
706
|
+
* ```
|
|
707
|
+
*/
|
|
708
|
+
function predicate(tags: (string | Hash)[]): Opaque<"render_predicate">;
|
|
709
|
+
/**
|
|
710
|
+
* Sets the blend equation with separate equations for the color and alpha channels.
|
|
711
|
+
*
|
|
712
|
+
* @param equation_color - color blend equation
|
|
713
|
+
* @param equation_alpha - alpha blend equation
|
|
714
|
+
* @example
|
|
715
|
+
* ```ts
|
|
716
|
+
* render.set_blend_equation_separate(graphics.BLEND_EQUATION_ADD, graphics.BLEND_EQUATION_REVERSE_SUBTRACT);
|
|
717
|
+
* ```
|
|
718
|
+
*/
|
|
719
|
+
function set_blend_equation_separate(equation_color: graphics.BLEND_EQUATION, equation_alpha: graphics.BLEND_EQUATION): void;
|
|
720
|
+
/**
|
|
721
|
+
* Specifies the arithmetic used when computing pixel values that are written to the frame
|
|
722
|
+
* buffer. In RGBA mode, pixels can be drawn using a function that blends the source RGBA
|
|
723
|
+
* pixel values with the destination pixel values already in the frame buffer.
|
|
724
|
+
* Blending is initially disabled.
|
|
725
|
+
* `source_factor` specifies which method is used to scale the source color components.
|
|
726
|
+
* `destination_factor` specifies which method is used to scale the destination color
|
|
727
|
+
* components.
|
|
728
|
+
* Source color components are referred to as (Rs,Gs,Bs,As).
|
|
729
|
+
* Destination color components are referred to as (Rd,Gd,Bd,Ad).
|
|
730
|
+
* The color specified by setting the blendcolor is referred to as (Rc,Gc,Bc,Ac).
|
|
731
|
+
* The source scale factor is referred to as (sR,sG,sB,sA).
|
|
732
|
+
* The destination scale factor is referred to as (dR,dG,dB,dA).
|
|
733
|
+
* The color values have integer values between 0 and (kR,kG,kB,kA), where kc = 2mc - 1 and mc is the number of bitplanes for that color. I.e for 8 bit color depth, color values are between `0` and `255`.
|
|
734
|
+
* The blended RGBA values of a pixel comes from the following equations:
|
|
735
|
+
*
|
|
736
|
+
* - Rd = min(kR, Rs * sR + Rd * dR)
|
|
737
|
+
* - Gd = min(kG, Gs * sG + Gd * dG)
|
|
738
|
+
* - Bd = min(kB, Bs * sB + Bd * dB)
|
|
739
|
+
* - Ad = min(kA, As * sA + Ad * dA)
|
|
740
|
+
*
|
|
741
|
+
* Blend function `(graphics.BLEND_FACTOR_SRC_ALPHA, graphics.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA)` is useful for
|
|
742
|
+
* drawing with transparency when the drawn objects are sorted from farthest to nearest.
|
|
743
|
+
* It is also useful for drawing antialiased points and lines in arbitrary order.
|
|
744
|
+
*
|
|
745
|
+
* @param source_factor - source factor
|
|
746
|
+
* @param destination_factor - destination factor
|
|
747
|
+
* @example
|
|
748
|
+
* ```ts
|
|
749
|
+
* // Set the blend func to the most common one:
|
|
750
|
+
* render.set_blend_func(graphics.BLEND_FACTOR_SRC_ALPHA, graphics.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA);
|
|
751
|
+
* ```
|
|
752
|
+
*/
|
|
753
|
+
function set_blend_func(source_factor: graphics.BLEND_FACTOR, destination_factor: graphics.BLEND_FACTOR): void;
|
|
754
|
+
/**
|
|
755
|
+
* Sets the blend function with separate blend factors for the color and alpha channels.
|
|
756
|
+
*
|
|
757
|
+
* @param source_factor_color - source color blend factor
|
|
758
|
+
* @param destination_factor_color - destination color blend factor
|
|
759
|
+
* @param source_factor_alpha - source alpha blend factor
|
|
760
|
+
* @param destination_factor_alpha - destination alpha blend factor
|
|
761
|
+
* @example
|
|
762
|
+
* ```ts
|
|
763
|
+
* render.set_blend_func_separate(graphics.BLEND_FACTOR_SRC_ALPHA, graphics.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, graphics.BLEND_FACTOR_ONE, graphics.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA);
|
|
764
|
+
* ```
|
|
765
|
+
*/
|
|
766
|
+
function set_blend_func_separate(source_factor_color: number, destination_factor_color: number, source_factor_alpha: number, destination_factor_alpha: number): void;
|
|
767
|
+
/**
|
|
768
|
+
* Sets the current render camera to be used for rendering. If a render camera
|
|
769
|
+
* has been set by the render script, the renderer will be using its projection and view matrix
|
|
770
|
+
* during rendering. If a projection and/or view matrix has been set by the render script,
|
|
771
|
+
* they will not be used until the current render camera has been reset by calling `render.set_camera()`.
|
|
772
|
+
* If the 'use_frustum' flag in the options table has been set to true, the renderer will automatically use the
|
|
773
|
+
* camera frustum for frustum culling regardless of what frustum is being passed into the render.draw() function.
|
|
774
|
+
* Note that the frustum plane option in render.draw can still be used together with the camera.
|
|
775
|
+
*
|
|
776
|
+
* @param camera - camera id to use, or nil to reset
|
|
777
|
+
* @param options - optional camera options
|
|
778
|
+
* @example
|
|
779
|
+
* Set the current camera to be used for rendering
|
|
780
|
+
* ```ts
|
|
781
|
+
* function draw_through_camera(self: { my_pred: Opaque<"render_predicate"> }) {
|
|
782
|
+
* render.set_camera("main:/my_go#camera");
|
|
783
|
+
* render.draw(self.my_pred);
|
|
784
|
+
* render.set_camera(undefined);
|
|
785
|
+
* }
|
|
786
|
+
* ```
|
|
787
|
+
* @example
|
|
788
|
+
* Use the camera frustum for frustum culling together with a specific frustum plane option for the draw command
|
|
789
|
+
* ```ts
|
|
790
|
+
* function draw_through_camera(self: { my_pred: Opaque<"render_predicate"> }) {
|
|
791
|
+
* // The camera frustum will take precedence over the frustum plane option in render.draw
|
|
792
|
+
* render.set_camera("main:/my_go#camera", { use_frustum: true });
|
|
793
|
+
* // However, we can still customize the frustum planes regardless of the camera option!
|
|
794
|
+
* render.draw(self.my_pred, { frustum_planes: render.FRUSTUM_PLANES_ALL });
|
|
795
|
+
* render.set_camera();
|
|
796
|
+
* }
|
|
797
|
+
* ```
|
|
798
|
+
*/
|
|
799
|
+
function set_camera(camera?: Url | number | string | Hash, options?: render.camera_options): void;
|
|
800
|
+
/**
|
|
801
|
+
* Specifies whether the individual color components in the frame buffer is enabled for writing (`true`) or disabled (`false`). For example, if `blue` is `false`, nothing is written to the blue component of any pixel in any of the color buffers, regardless of the drawing operation attempted. Note that writing are either enabled or disabled for entire color components, not the individual bits of a component.
|
|
802
|
+
* The component masks are all initially `true`.
|
|
803
|
+
*
|
|
804
|
+
* @param red - red mask
|
|
805
|
+
* @param green - green mask
|
|
806
|
+
* @param blue - blue mask
|
|
807
|
+
* @param alpha - alpha mask
|
|
808
|
+
* @example
|
|
809
|
+
* ```ts
|
|
810
|
+
* // alpha cannot be written to frame buffer
|
|
811
|
+
* render.set_color_mask(true, true, true, false);
|
|
812
|
+
* ```
|
|
813
|
+
*/
|
|
814
|
+
function set_color_mask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void;
|
|
815
|
+
/**
|
|
816
|
+
* The name of the compute program must be specified in the ".render" resource set
|
|
817
|
+
* in the "game.project" setting. If nil (or no arguments) are passed to this function,
|
|
818
|
+
* the current compute program will instead be disabled.
|
|
819
|
+
*
|
|
820
|
+
* @param compute - compute id to use, or nil to disable
|
|
821
|
+
* @example
|
|
822
|
+
* ```ts
|
|
823
|
+
* export default defineRenderScript({
|
|
824
|
+
* init() {
|
|
825
|
+
* return { backing_texture: "my_texture_resource" };
|
|
826
|
+
* },
|
|
827
|
+
*
|
|
828
|
+
* update(self, dt) {
|
|
829
|
+
* // Enable compute program named "fractals", then dispatch it.
|
|
830
|
+
* render.set_compute("fractals");
|
|
831
|
+
* render.enable_texture(0, self.backing_texture);
|
|
832
|
+
* render.dispatch_compute(128, 128, 1);
|
|
833
|
+
* render.set_compute();
|
|
834
|
+
* },
|
|
835
|
+
* });
|
|
836
|
+
* ```
|
|
837
|
+
*/
|
|
838
|
+
function set_compute(compute?: string | Hash): void;
|
|
839
|
+
/**
|
|
840
|
+
* Specifies whether front- or back-facing polygons can be culled
|
|
841
|
+
* when polygon culling is enabled. Polygon culling is initially disabled.
|
|
842
|
+
* If mode is `graphics.FACE_TYPE_FRONT_AND_BACK`, no polygons are drawn, but other
|
|
843
|
+
* primitives such as points and lines are drawn. The initial value for
|
|
844
|
+
* `face_type` is `graphics.FACE_TYPE_BACK`.
|
|
845
|
+
*
|
|
846
|
+
* @param face_type - face type
|
|
847
|
+
* @example
|
|
848
|
+
* ```ts
|
|
849
|
+
* // How to enable polygon culling and set front face culling:
|
|
850
|
+
* render.enable_state(graphics.STATE_CULL_FACE);
|
|
851
|
+
* render.set_cull_face(graphics.FACE_TYPE_FRONT);
|
|
852
|
+
* ```
|
|
853
|
+
*/
|
|
854
|
+
function set_cull_face(face_type: graphics.FACE_TYPE): void;
|
|
855
|
+
/**
|
|
856
|
+
* Specifies the function that should be used to compare each incoming pixel
|
|
857
|
+
* depth value with the value present in the depth buffer.
|
|
858
|
+
* The comparison is performed only if depth testing is enabled and specifies
|
|
859
|
+
* the conditions under which a pixel will be drawn.
|
|
860
|
+
* The depth function is initially set to `graphics.COMPARE_FUNC_LESS`.
|
|
861
|
+
*
|
|
862
|
+
* @param func - depth test function, see the description for available values
|
|
863
|
+
* @example
|
|
864
|
+
* ```ts
|
|
865
|
+
* // Enable depth test and set the depth test function to "not equal".
|
|
866
|
+
* render.enable_state(graphics.STATE_DEPTH_TEST);
|
|
867
|
+
* render.set_depth_func(graphics.COMPARE_FUNC_NOTEQUAL);
|
|
868
|
+
* ```
|
|
869
|
+
*/
|
|
870
|
+
function set_depth_func(func: graphics.COMPARE_FUNC): void;
|
|
871
|
+
/**
|
|
872
|
+
* Specifies whether the depth buffer is enabled for writing. The supplied mask governs
|
|
873
|
+
* if depth buffer writing is enabled (`true`) or disabled (`false`).
|
|
874
|
+
* The mask is initially `true`.
|
|
875
|
+
*
|
|
876
|
+
* @param depth - depth mask
|
|
877
|
+
* @example
|
|
878
|
+
* ```ts
|
|
879
|
+
* // How to turn off writing to the depth buffer:
|
|
880
|
+
* render.set_depth_mask(false);
|
|
881
|
+
* ```
|
|
882
|
+
*/
|
|
883
|
+
function set_depth_mask(depth: boolean): void;
|
|
884
|
+
/**
|
|
885
|
+
* Set or remove the rendering-context event listener.
|
|
886
|
+
*
|
|
887
|
+
* @param callback - A callback that receives all render related events.
|
|
888
|
+
* Pass `nil` if want to remove listener.
|
|
889
|
+
* @example
|
|
890
|
+
* ```ts
|
|
891
|
+
* // Set listener and handle render context events.
|
|
892
|
+
* // custom.render_script
|
|
893
|
+
* export default defineRenderScript({
|
|
894
|
+
* init() {
|
|
895
|
+
* render.set_listener((self, event_type) => {
|
|
896
|
+
* if (event_type === render.CONTEXT_EVENT_CONTEXT_LOST) {
|
|
897
|
+
* // Some stuff when rendering context is lost
|
|
898
|
+
* } else if (event_type === render.CONTEXT_EVENT_CONTEXT_RESTORED) {
|
|
899
|
+
* // Start reload resources, reload game, etc.
|
|
900
|
+
* }
|
|
901
|
+
* });
|
|
902
|
+
* },
|
|
903
|
+
* });
|
|
904
|
+
* ```
|
|
905
|
+
*/
|
|
906
|
+
function set_listener(callback?: (self: unknown, event_type: render.CONTEXT_EVENT) => void): void;
|
|
907
|
+
/**
|
|
908
|
+
* Sets the scale and units used to calculate depth values.
|
|
909
|
+
* If `graphics.STATE_POLYGON_OFFSET_FILL` is enabled, each fragment's depth value
|
|
910
|
+
* is offset from its interpolated value (depending on the depth value of the
|
|
911
|
+
* appropriate vertices). Polygon offset can be used when drawing decals, rendering
|
|
912
|
+
* hidden-line images etc.
|
|
913
|
+
* `factor` specifies a scale factor that is used to create a variable depth
|
|
914
|
+
* offset for each polygon. The initial value is `0`.
|
|
915
|
+
* `units` is multiplied by an implementation-specific value to create a
|
|
916
|
+
* constant depth offset. The initial value is `0`.
|
|
917
|
+
* The value of the offset is computed as `factor` × `DZ` + `r` × `units`
|
|
918
|
+
* `DZ` is a measurement of the depth slope of the polygon which is the change in z (depth)
|
|
919
|
+
* values divided by the change in either x or y coordinates, as you traverse a polygon.
|
|
920
|
+
* The depth values are in window coordinates, clamped to the range [0, 1].
|
|
921
|
+
* `r` is the smallest value that is guaranteed to produce a resolvable difference.
|
|
922
|
+
* It's value is an implementation-specific constant.
|
|
923
|
+
* The offset is added before the depth test is performed and before the
|
|
924
|
+
* value is written into the depth buffer.
|
|
925
|
+
*
|
|
926
|
+
* @param factor - polygon offset factor
|
|
927
|
+
* @param units - polygon offset units
|
|
928
|
+
* @example
|
|
929
|
+
* ```ts
|
|
930
|
+
* render.enable_state(graphics.STATE_POLYGON_OFFSET_FILL);
|
|
931
|
+
* render.set_polygon_offset(1.0, 1.0);
|
|
932
|
+
* ```
|
|
933
|
+
*/
|
|
934
|
+
function set_polygon_offset(factor: number, units: number): void;
|
|
935
|
+
/**
|
|
936
|
+
* Sets the projection matrix to use when rendering.
|
|
937
|
+
*
|
|
938
|
+
* @param matrix - projection matrix
|
|
939
|
+
* @example
|
|
940
|
+
* ```ts
|
|
941
|
+
* // How to set the projection to orthographic with world origo at lower left,
|
|
942
|
+
* // width and height as set in project settings and depth (z) between -1 and 1:
|
|
943
|
+
* render.set_projection(vmath.matrix4_orthographic(0, render.get_width(), 0, render.get_height(), -1, 1));
|
|
944
|
+
* ```
|
|
945
|
+
*/
|
|
946
|
+
function set_projection(matrix: Matrix4): void;
|
|
947
|
+
/**
|
|
948
|
+
* Sets a render target. Subsequent draw operations will be to the
|
|
949
|
+
* render target until it is replaced by a subsequent call to set_render_target.
|
|
950
|
+
* This function supports render targets created by a render script, or a render target resource.
|
|
951
|
+
*
|
|
952
|
+
* @param render_target - render target to set. Omit it, pass `nil`, or use render.RENDER_TARGET_DEFAULT to set the default render target
|
|
953
|
+
* @param options - optional render-target activation options
|
|
954
|
+
* @example
|
|
955
|
+
* How to set a render target and draw to it and then switch back to the default render target
|
|
956
|
+
* The render target defines the depth/stencil buffers as transient, when set_render_target is called the next time the buffers may be invalidated and allow for optimisations depending on driver support
|
|
957
|
+
* ```ts
|
|
958
|
+
* // How to set a render target and draw to it and then switch back to the default render target
|
|
959
|
+
* // The render target defines the depth/stencil buffers as transient, when set_render_target is called the next time the buffers may be invalidated and allow for optimisations depending on driver support
|
|
960
|
+
* export default defineRenderScript({
|
|
961
|
+
* init() {
|
|
962
|
+
* const color_params = {
|
|
963
|
+
* format: graphics.TEXTURE_FORMAT_RGBA,
|
|
964
|
+
* width: render.get_window_width(),
|
|
965
|
+
* height: render.get_window_height(),
|
|
966
|
+
* };
|
|
967
|
+
* return {
|
|
968
|
+
* my_render_target: render.render_target({ [graphics.BUFFER_TYPE_COLOR0_BIT]: color_params }),
|
|
969
|
+
* my_pred: render.predicate([hash("my_tag")]),
|
|
970
|
+
* };
|
|
971
|
+
* },
|
|
972
|
+
*
|
|
973
|
+
* update(self, dt) {
|
|
974
|
+
* // set render target so all drawing is done to it
|
|
975
|
+
* render.set_render_target(self.my_render_target, {
|
|
976
|
+
* transient: [graphics.BUFFER_TYPE_DEPTH_BIT, graphics.BUFFER_TYPE_STENCIL_BIT],
|
|
977
|
+
* });
|
|
978
|
+
*
|
|
979
|
+
* // draw a predicate to the render target
|
|
980
|
+
* render.draw(self.my_pred);
|
|
981
|
+
*
|
|
982
|
+
* // set default render target. This also invalidates the depth and stencil buffers of the current target (self.my_render_target)
|
|
983
|
+
* // which can be an optimisation on some hardware
|
|
984
|
+
* render.set_render_target(render.RENDER_TARGET_DEFAULT);
|
|
985
|
+
* },
|
|
986
|
+
* });
|
|
987
|
+
* ```
|
|
988
|
+
* @example
|
|
989
|
+
* ```ts
|
|
990
|
+
* export default defineRenderScript({
|
|
991
|
+
* init() {
|
|
992
|
+
* return { my_pred: render.predicate([hash("my_tag")]) };
|
|
993
|
+
* },
|
|
994
|
+
*
|
|
995
|
+
* update(self, dt) {
|
|
996
|
+
* // set render target by a render target resource identifier
|
|
997
|
+
* render.set_render_target("my_rt_resource");
|
|
998
|
+
*
|
|
999
|
+
* // draw a predicate to the render target
|
|
1000
|
+
* render.draw(self.my_pred);
|
|
1001
|
+
*
|
|
1002
|
+
* // reset the render target to the default backbuffer
|
|
1003
|
+
* render.set_render_target(render.RENDER_TARGET_DEFAULT);
|
|
1004
|
+
* },
|
|
1005
|
+
* });
|
|
1006
|
+
* ```
|
|
1007
|
+
*/
|
|
1008
|
+
function set_render_target(render_target?: Opaque<"render_target"> | string | Hash | typeof render.RENDER_TARGET_DEFAULT, options?: render.set_render_target_options): void;
|
|
1009
|
+
/**
|
|
1010
|
+
* Sets the render target size for a render target created from
|
|
1011
|
+
* either a render script, or from a render target resource.
|
|
1012
|
+
*
|
|
1013
|
+
* @param render_target - render target to set size for
|
|
1014
|
+
* @param width - new render target width
|
|
1015
|
+
* @param height - new render target height
|
|
1016
|
+
* @example
|
|
1017
|
+
* ```ts
|
|
1018
|
+
* export default defineRenderScript({
|
|
1019
|
+
* init() {
|
|
1020
|
+
* return { my_render_target: render.render_target("my_target", {}) };
|
|
1021
|
+
* },
|
|
1022
|
+
*
|
|
1023
|
+
* update(self, dt) {
|
|
1024
|
+
* // Resize render targets to the current window size:
|
|
1025
|
+
* render.set_render_target_size(self.my_render_target, render.get_window_width(), render.get_window_height());
|
|
1026
|
+
* render.set_render_target_size("my_rt_resource", render.get_window_width(), render.get_window_height());
|
|
1027
|
+
* },
|
|
1028
|
+
* });
|
|
1029
|
+
* ```
|
|
1030
|
+
*/
|
|
1031
|
+
function set_render_target_size(render_target: Opaque<"render_target"> | string | Hash, width: number, height: number): void;
|
|
1032
|
+
/**
|
|
1033
|
+
* Stenciling is similar to depth-buffering as it enables and disables drawing on a
|
|
1034
|
+
* per-pixel basis. First, GL drawing primitives are drawn into the stencil planes.
|
|
1035
|
+
* Second, geometry and images are rendered but using the stencil planes to mask out
|
|
1036
|
+
* where to draw.
|
|
1037
|
+
* The stencil test discards a pixel based on the outcome of a comparison between the
|
|
1038
|
+
* reference value `ref` and the corresponding value in the stencil buffer.
|
|
1039
|
+
* `func` specifies the comparison function.
|
|
1040
|
+
* The initial value is `graphics.COMPARE_FUNC_ALWAYS`.
|
|
1041
|
+
* `ref` specifies the reference value for the stencil test. The value is clamped to
|
|
1042
|
+
* the range [0, 2n-1], where n is the number of bitplanes in the stencil buffer.
|
|
1043
|
+
* The initial value is `0`.
|
|
1044
|
+
* `mask` is ANDed with both the reference value and the stored stencil value when the test
|
|
1045
|
+
* is done. The initial value is all `1`'s.
|
|
1046
|
+
*
|
|
1047
|
+
* @param func - stencil test function, see the description for available values
|
|
1048
|
+
* @param ref - reference value for the stencil test
|
|
1049
|
+
* @param mask - mask that is ANDed with both the reference value and the stored stencil value when the test is done
|
|
1050
|
+
* @example
|
|
1051
|
+
* ```ts
|
|
1052
|
+
* // let only 0's pass the stencil test
|
|
1053
|
+
* render.set_stencil_func(graphics.COMPARE_FUNC_EQUAL, 0, 1);
|
|
1054
|
+
* ```
|
|
1055
|
+
*/
|
|
1056
|
+
function set_stencil_func(func: graphics.COMPARE_FUNC, ref: number, mask: number): void;
|
|
1057
|
+
/**
|
|
1058
|
+
* The stencil mask controls the writing of individual bits in the stencil buffer.
|
|
1059
|
+
* The least significant `n` bits of the parameter `mask`, where `n` is the number of
|
|
1060
|
+
* bits in the stencil buffer, specify the mask.
|
|
1061
|
+
* Where a `1` bit appears in the mask, the corresponding
|
|
1062
|
+
* bit in the stencil buffer can be written. Where a `0` bit appears in the mask,
|
|
1063
|
+
* the corresponding bit in the stencil buffer is never written.
|
|
1064
|
+
* The mask is initially all `1`'s.
|
|
1065
|
+
*
|
|
1066
|
+
* @param mask - stencil mask
|
|
1067
|
+
* @example
|
|
1068
|
+
* ```ts
|
|
1069
|
+
* // set the stencil mask to all 1:s
|
|
1070
|
+
* render.set_stencil_mask(0xff);
|
|
1071
|
+
* ```
|
|
1072
|
+
*/
|
|
1073
|
+
function set_stencil_mask(mask: number): void;
|
|
1074
|
+
/**
|
|
1075
|
+
* The stencil test discards a pixel based on the outcome of a comparison between the
|
|
1076
|
+
* reference value `ref` and the corresponding value in the stencil buffer.
|
|
1077
|
+
* To control the test, call render.set_stencil_func.
|
|
1078
|
+
* This function takes three arguments that control what happens to the stored stencil
|
|
1079
|
+
* value while stenciling is enabled. If the stencil test fails, no change is made to the
|
|
1080
|
+
* pixel's color or depth buffers, and `sfail` specifies what happens to the stencil buffer
|
|
1081
|
+
* contents.
|
|
1082
|
+
* `dppass` and `dpfail` specify the stencil buffer actions depending on whether subsequent
|
|
1083
|
+
* depth buffer tests succeed (dppass) or fail (dpfail).
|
|
1084
|
+
* The initial value for all operators is `graphics.STENCIL_OP_KEEP`.
|
|
1085
|
+
*
|
|
1086
|
+
* @param sfail - action to take when the stencil test fails
|
|
1087
|
+
* @param dpfail - the stencil action when the stencil test passes
|
|
1088
|
+
* @param dppass - the stencil action when both the stencil test and the depth test pass, or when the stencil test passes and either there is no depth buffer or depth testing is not enabled
|
|
1089
|
+
* @example
|
|
1090
|
+
* ```ts
|
|
1091
|
+
* // Set the stencil function to never pass and operator to always draw 1's
|
|
1092
|
+
* // on test fail.
|
|
1093
|
+
* render.set_stencil_func(graphics.COMPARE_FUNC_NEVER, 1, 0xFF);
|
|
1094
|
+
* // always draw 1's on test fail
|
|
1095
|
+
* render.set_stencil_op(graphics.STENCIL_OP_REPLACE, graphics.STENCIL_OP_KEEP, graphics.STENCIL_OP_KEEP);
|
|
1096
|
+
* ```
|
|
1097
|
+
*/
|
|
1098
|
+
function set_stencil_op(sfail: graphics.STENCIL_OP, dpfail: graphics.STENCIL_OP, dppass: graphics.STENCIL_OP): void;
|
|
1099
|
+
/**
|
|
1100
|
+
* Sets the view matrix to use when rendering.
|
|
1101
|
+
*
|
|
1102
|
+
* @param matrix - view matrix to set
|
|
1103
|
+
* @example
|
|
1104
|
+
* ```ts
|
|
1105
|
+
* // How to set the view and projection matrices according to
|
|
1106
|
+
* // the values supplied by a camera.
|
|
1107
|
+
* export default defineRenderScript({
|
|
1108
|
+
* init() {
|
|
1109
|
+
* return {
|
|
1110
|
+
* view: vmath.matrix4(),
|
|
1111
|
+
* projection: vmath.matrix4(),
|
|
1112
|
+
* };
|
|
1113
|
+
* },
|
|
1114
|
+
*
|
|
1115
|
+
* update(self, dt) {
|
|
1116
|
+
* // set the view to the stored view value
|
|
1117
|
+
* render.set_view(self.view);
|
|
1118
|
+
* // now we can draw with this view
|
|
1119
|
+
* },
|
|
1120
|
+
*
|
|
1121
|
+
* on_message(self, message_id, message) {
|
|
1122
|
+
* if (
|
|
1123
|
+
* message_id === hash("set_view_projection") &&
|
|
1124
|
+
* types.is_matrix4(message.view) &&
|
|
1125
|
+
* types.is_matrix4(message.projection)
|
|
1126
|
+
* ) {
|
|
1127
|
+
* // camera view and projection arrives here.
|
|
1128
|
+
* self.view = message.view;
|
|
1129
|
+
* self.projection = message.projection;
|
|
1130
|
+
* }
|
|
1131
|
+
* },
|
|
1132
|
+
* });
|
|
1133
|
+
* ```
|
|
1134
|
+
*/
|
|
1135
|
+
function set_view(matrix: Matrix4): void;
|
|
1136
|
+
/**
|
|
1137
|
+
* Set the render viewport to the specified rectangle.
|
|
1138
|
+
*
|
|
1139
|
+
* @param x - left corner
|
|
1140
|
+
* @param y - bottom corner
|
|
1141
|
+
* @param width - viewport width
|
|
1142
|
+
* @param height - viewport height
|
|
1143
|
+
* @example
|
|
1144
|
+
* ```ts
|
|
1145
|
+
* // Set the viewport to the window dimensions.
|
|
1146
|
+
* render.set_viewport(0, 0, render.get_window_width(), render.get_window_height());
|
|
1147
|
+
* ```
|
|
1148
|
+
*/
|
|
1149
|
+
function set_viewport(x: number, y: number, width: number, height: number): void;
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
export {};
|