@jack120/test 0.2.0 → 0.2.2
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/dist/index.d.ts +1140 -0
- package/dist/index.js +1 -2415
- package/package.json +7 -2
- package/{library/adamas-types.d.ts → types/index.d.ts} +2 -5
- package/.gitmodules +0 -3
- package/.prettierrc +0 -6
- package/.vscode/c_cpp_properties.json +0 -14
- package/.vscode/launch.json +0 -24
- package/.vscode/settings.json +0 -8
- package/CMakeLists.txt +0 -52
- package/adamas-config.json +0 -5
- package/external/CMakeLists.txt +0 -1
- package/external/Unity-NodeJS-RPC/CMakeLists.txt +0 -13
- package/external/Unity-NodeJS-RPC/README.md +0 -1
- package/external/Unity-NodeJS-RPC/RpcClient.cpp +0 -265
- package/external/Unity-NodeJS-RPC/include/RpcClient.h +0 -118
- package/external/Unity-NodeJS-RPC/main.cpp +0 -76
- package/external/Unity-NodeJS-RPC/nlohmann/json.hpp +0 -25526
- package/external/Unity-NodeJS-RPC/server/Program.cs +0 -52
- package/external/Unity-NodeJS-RPC/server/json.cs +0 -66
- package/external/Unity-NodeJS-RPC/server/rpc.cs +0 -369
- package/external/Unity-NodeJS-RPC/server/sample1.csproj +0 -10
- package/external/Unity-NodeJS-RPC/server/sample1.sln +0 -24
- package/external/Unity-NodeJS-RPC/server/unity/RpcUnity.cs.txt +0 -60
- package/index.ts +0 -36
- package/library/debug.ts +0 -7
- package/library/device.ts +0 -279
- package/library/entity.ts +0 -35
- package/library/index.ts +0 -19
- package/library/interaction/interaction.ts +0 -281
- package/library/native-bindings-osx.node +0 -0
- package/library/native-bindings-win.node +0 -0
- package/library/networking/state-sync.ts +0 -62
- package/library/physics/collider.ts +0 -252
- package/library/physics/rigidbody.ts +0 -119
- package/library/render/camera.ts +0 -172
- package/library/render/light.ts +0 -169
- package/library/render/material.ts +0 -258
- package/library/render/mesh.ts +0 -208
- package/library/render/primitives.ts +0 -76
- package/library/render/renderable.ts +0 -137
- package/library/render/renderer.ts +0 -124
- package/library/render/scene.ts +0 -89
- package/library/render/texture.ts +0 -247
- package/library/render/transform.ts +0 -259
- package/library/rpc.ts +0 -81
- package/library/utilities/base64.ts +0 -63
- package/loader-template.ts +0 -419
- package/native.cc +0 -111
- package/project.adamas.json +0 -457
- package/rusk.glb +0 -0
- package/samples/device-sample.ts +0 -30
- package/samples/interaction-sample.ts +0 -134
- package/samples/physics-sample.ts +0 -39
- package/samples/rendering-sample.ts +0 -88
- package/samples/spawn-cube.ts +0 -422
- package/samples/state-sync-sample.ts +0 -25
- package/tsconfig.json +0 -20
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1140 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
import { mat4, quat, vec2, vec3, vec4 } from 'gl-matrix';
|
|
4
|
+
|
|
5
|
+
export declare class RpcClient {
|
|
6
|
+
static Init(): void;
|
|
7
|
+
static RegisterCallback(callback: (...args: any[]) => any): number;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param funcName RPC function name to call
|
|
11
|
+
* @param args Arguments of RPC in the format: `{parameter0: value0, parameter1: value1}`
|
|
12
|
+
* @returns The value returned from RPC function in string type
|
|
13
|
+
*/
|
|
14
|
+
static Call(funcName: string, args: object): any;
|
|
15
|
+
static GetClientId(): number;
|
|
16
|
+
static objectToKeyValue(obj: Record<string, any>): {
|
|
17
|
+
keys: string[];
|
|
18
|
+
values: any[];
|
|
19
|
+
};
|
|
20
|
+
static keyValueToObject(keys: string[], values: any[]): Record<string, any>;
|
|
21
|
+
static callbackRegistry: {
|
|
22
|
+
[key: number]: (...args: any[]) => any;
|
|
23
|
+
};
|
|
24
|
+
static initialized: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare class Debug {
|
|
27
|
+
static OnCmdCallback(fn: (...args: any[]) => any): any;
|
|
28
|
+
}
|
|
29
|
+
export declare class Device {
|
|
30
|
+
static GetLeftPosition(): any;
|
|
31
|
+
static GetLeftRotation(): any;
|
|
32
|
+
static GetLeftThumbstick(): any;
|
|
33
|
+
static GetLeftSelect(): any;
|
|
34
|
+
static GetLeftActivate(): any;
|
|
35
|
+
static GetLeftTurn(): any;
|
|
36
|
+
static GetLeftSnapTurn(): any;
|
|
37
|
+
static GetLeftMove(): any;
|
|
38
|
+
static GetLeftGrabMove(): any;
|
|
39
|
+
static GetRightPosition(): any;
|
|
40
|
+
static GetRightRotation(): any;
|
|
41
|
+
static GetRightThumbstick(): any;
|
|
42
|
+
static GetRightSelect(): any;
|
|
43
|
+
static GetRightActivate(): any;
|
|
44
|
+
static GetRightTurn(): any;
|
|
45
|
+
static GetRightSnapTurn(): any;
|
|
46
|
+
static GetRightMove(): any;
|
|
47
|
+
static GetRightGrabMove(): any;
|
|
48
|
+
static GetHeadPosition(): any;
|
|
49
|
+
static GetHeadRotation(): any;
|
|
50
|
+
static GetLeftWorldPosition(): any;
|
|
51
|
+
static GetLeftWorldRotation(): any;
|
|
52
|
+
static GetRightWorldPosition(): any;
|
|
53
|
+
static GetRightWorldRotation(): any;
|
|
54
|
+
static GetHeadWorldPosition(): any;
|
|
55
|
+
static GetHeadWorldRotation(): any;
|
|
56
|
+
}
|
|
57
|
+
export declare class XRSystem {
|
|
58
|
+
static KEYCODE: Readonly<{
|
|
59
|
+
LEFT_EYE: "Left Eye";
|
|
60
|
+
RIGHT_EYE: "Right Eye";
|
|
61
|
+
LEFT_AIM: "Left Aim";
|
|
62
|
+
RIGHT_AIM: "Right Aim";
|
|
63
|
+
LEFT_GRIP: "Left Grip";
|
|
64
|
+
RIGHT_GRIP: "Right Grip";
|
|
65
|
+
LEFT_SQUEEZE: "Left Squeeze";
|
|
66
|
+
RIGHT_SQUEEZE: "Right Squeeze";
|
|
67
|
+
LEFT_TRIGGER: "Left Trigger";
|
|
68
|
+
RIGHT_TRIGGER: "Right Trigger";
|
|
69
|
+
LEFT_THUMBSTICK_X: "Left Thumbstick X";
|
|
70
|
+
RIGHT_THUMBSTICK_X: "Right Thumbstick X";
|
|
71
|
+
LEFT_THUMBSTICK_Y: "Left Thumbstick Y";
|
|
72
|
+
RIGHT_THUMBSTICK_Y: "Right Thumbstick Y";
|
|
73
|
+
LEFT_TRIGGER_TOUCH: "Left Trigger Touch";
|
|
74
|
+
RIGHT_TRIGGER_TOUCH: "Right Trigger Touch";
|
|
75
|
+
LEFT_THUMBSTICK_CLICK: "Left Thumbstick Click";
|
|
76
|
+
RIGHT_THUMBSTICK_CLICK: "Right Thumbstick Click";
|
|
77
|
+
LEFT_THUMBSTICK_TOUCH: "Left Thumbstick Touch";
|
|
78
|
+
RIGHT_THUMBSTICK_TOUCH: "Right Thumbstick Touch";
|
|
79
|
+
LEFT_X_CLICK: "Left X Click";
|
|
80
|
+
LEFT_X_TOUCH: "Left X Touch";
|
|
81
|
+
LEFT_Y_CLICK: "Left Y Click";
|
|
82
|
+
LEFT_Y_TOUCH: "Left Y Touch";
|
|
83
|
+
LEFT_MENU_CLICK: "Left Menu Click";
|
|
84
|
+
RIGHT_A_CLICK: "Right A Click";
|
|
85
|
+
RIGHT_A_TOUCH: "Right A Touch";
|
|
86
|
+
RIGHT_B_CLIKC: "Right B Click";
|
|
87
|
+
RIGHT_B_TOUCH: "Right B Touch";
|
|
88
|
+
RIGHT_SYSTEM_CLICK: "Right System Click";
|
|
89
|
+
}>;
|
|
90
|
+
}
|
|
91
|
+
export declare class Keyboard {
|
|
92
|
+
static MOUSE: Readonly<{
|
|
93
|
+
BUTTON_LEFT: 0;
|
|
94
|
+
BUTTON_RIGHT: 1;
|
|
95
|
+
BUTTON_MIDDLE: 2;
|
|
96
|
+
}>;
|
|
97
|
+
static KEYCODE: Readonly<{
|
|
98
|
+
SPACE: 32;
|
|
99
|
+
APOSTROPHE: 39;
|
|
100
|
+
COMMA: 44;
|
|
101
|
+
MINUS: 45;
|
|
102
|
+
PERIOD: 46;
|
|
103
|
+
SLASH: 47;
|
|
104
|
+
NUM_0: 48;
|
|
105
|
+
NUM_1: 49;
|
|
106
|
+
NUM_2: 50;
|
|
107
|
+
NUM_3: 51;
|
|
108
|
+
NUM_4: 52;
|
|
109
|
+
NUM_5: 53;
|
|
110
|
+
NUM_6: 54;
|
|
111
|
+
NUM_7: 55;
|
|
112
|
+
NUM_8: 56;
|
|
113
|
+
NUM_9: 57;
|
|
114
|
+
SEMICOLON: 59;
|
|
115
|
+
EQUAL: 61;
|
|
116
|
+
A: 65;
|
|
117
|
+
B: 66;
|
|
118
|
+
C: 67;
|
|
119
|
+
D: 68;
|
|
120
|
+
E: 69;
|
|
121
|
+
F: 70;
|
|
122
|
+
G: 71;
|
|
123
|
+
H: 72;
|
|
124
|
+
I: 73;
|
|
125
|
+
J: 74;
|
|
126
|
+
K: 75;
|
|
127
|
+
L: 76;
|
|
128
|
+
M: 77;
|
|
129
|
+
N: 78;
|
|
130
|
+
O: 79;
|
|
131
|
+
P: 80;
|
|
132
|
+
Q: 81;
|
|
133
|
+
R: 82;
|
|
134
|
+
S: 83;
|
|
135
|
+
T: 84;
|
|
136
|
+
U: 85;
|
|
137
|
+
V: 86;
|
|
138
|
+
W: 87;
|
|
139
|
+
X: 88;
|
|
140
|
+
Y: 89;
|
|
141
|
+
Z: 90;
|
|
142
|
+
LEFT_BRACKET: 91;
|
|
143
|
+
BACKSLASH: 92;
|
|
144
|
+
RIGHT_BRACKET: 93;
|
|
145
|
+
GRAVE_ACCENT: 96;
|
|
146
|
+
WORLD_1: 161;
|
|
147
|
+
WORLD_2: 162;
|
|
148
|
+
ESCAPE: 256;
|
|
149
|
+
ENTER: 257;
|
|
150
|
+
TAB: 258;
|
|
151
|
+
BACKSPACE: 259;
|
|
152
|
+
INSERT: 260;
|
|
153
|
+
DELETE: 261;
|
|
154
|
+
RIGHT: 262;
|
|
155
|
+
LEFT: 263;
|
|
156
|
+
DOWN: 264;
|
|
157
|
+
UP: 265;
|
|
158
|
+
PAGE_UP: 266;
|
|
159
|
+
PAGE_DOWN: 267;
|
|
160
|
+
HOME: 268;
|
|
161
|
+
END: 269;
|
|
162
|
+
CAPS_LOCK: 280;
|
|
163
|
+
SCROLL_LOCK: 281;
|
|
164
|
+
NUM_LOCK: 282;
|
|
165
|
+
PRINT_SCREEN: 283;
|
|
166
|
+
PAUSE: 284;
|
|
167
|
+
F1: 290;
|
|
168
|
+
F2: 291;
|
|
169
|
+
F3: 292;
|
|
170
|
+
F4: 293;
|
|
171
|
+
F5: 294;
|
|
172
|
+
F6: 295;
|
|
173
|
+
F7: 296;
|
|
174
|
+
F8: 297;
|
|
175
|
+
F9: 298;
|
|
176
|
+
F10: 299;
|
|
177
|
+
F11: 300;
|
|
178
|
+
F12: 301;
|
|
179
|
+
F13: 302;
|
|
180
|
+
F14: 303;
|
|
181
|
+
F15: 304;
|
|
182
|
+
F16: 305;
|
|
183
|
+
F17: 306;
|
|
184
|
+
F18: 307;
|
|
185
|
+
F19: 308;
|
|
186
|
+
F20: 309;
|
|
187
|
+
F21: 310;
|
|
188
|
+
F22: 311;
|
|
189
|
+
F23: 312;
|
|
190
|
+
F24: 313;
|
|
191
|
+
F25: 314;
|
|
192
|
+
KP_0: 320;
|
|
193
|
+
KP_1: 321;
|
|
194
|
+
KP_2: 322;
|
|
195
|
+
KP_3: 323;
|
|
196
|
+
KP_4: 324;
|
|
197
|
+
KP_5: 325;
|
|
198
|
+
KP_6: 326;
|
|
199
|
+
KP_7: 327;
|
|
200
|
+
KP_8: 328;
|
|
201
|
+
KP_9: 329;
|
|
202
|
+
KP_DECIMAL: 330;
|
|
203
|
+
KP_DIVIDE: 331;
|
|
204
|
+
KP_MULTIPLY: 332;
|
|
205
|
+
KP_SUBTRACT: 333;
|
|
206
|
+
KP_ADD: 334;
|
|
207
|
+
KP_ENTER: 335;
|
|
208
|
+
KP_EQUAL: 336;
|
|
209
|
+
LEFT_SHIFT: 340;
|
|
210
|
+
LEFT_CONTROL: 341;
|
|
211
|
+
LEFT_ALT: 342;
|
|
212
|
+
LEFT_SUPER: 343;
|
|
213
|
+
RIGHT_SHIFT: 344;
|
|
214
|
+
RIGHT_CONTROL: 345;
|
|
215
|
+
RIGHT_ALT: 346;
|
|
216
|
+
RIGHT_SUPER: 347;
|
|
217
|
+
MENU: 348;
|
|
218
|
+
}>;
|
|
219
|
+
static ACTION: Readonly<{
|
|
220
|
+
RELEASE: 0;
|
|
221
|
+
PRESS: 1;
|
|
222
|
+
REPEAT: 2;
|
|
223
|
+
}>;
|
|
224
|
+
static MODIFIER: Readonly<{
|
|
225
|
+
SHIFT: 1;
|
|
226
|
+
CONTROL: 2;
|
|
227
|
+
ALT: 4;
|
|
228
|
+
SUPER: 8;
|
|
229
|
+
CAPS_LOCK: 16;
|
|
230
|
+
NUM_LOCK: 32;
|
|
231
|
+
}>;
|
|
232
|
+
}
|
|
233
|
+
export type Entity = number;
|
|
234
|
+
export declare class EntityManager {
|
|
235
|
+
/**
|
|
236
|
+
* Create a new Entity
|
|
237
|
+
* @returns {Entity}
|
|
238
|
+
*/
|
|
239
|
+
static Create(name: string): Entity;
|
|
240
|
+
/**
|
|
241
|
+
* Destroys an Entity.
|
|
242
|
+
* @param {Entity} entity
|
|
243
|
+
* @returns {Boolean} If entity is destroyed successfully
|
|
244
|
+
*/
|
|
245
|
+
static Destroy(entityHandle: Entity): boolean;
|
|
246
|
+
static SetName(entityHandle: Entity, name: string): boolean;
|
|
247
|
+
static GetName(entityHandle: Entity): string;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Provides a static interface for managing XR grab interactable components
|
|
251
|
+
* on entities via RPC. This includes lifecycle management, configuration of
|
|
252
|
+
* grab behaviors (position, rotation, scale), and interaction event callbacks.
|
|
253
|
+
*/
|
|
254
|
+
export declare class GrabInteractableManager {
|
|
255
|
+
/**
|
|
256
|
+
* Creates a grab interactable component for the specified entity.
|
|
257
|
+
* All colliders added before this component is add are used to detect grabbing
|
|
258
|
+
* @param entityHandle The entity to attach the grab interactable to.
|
|
259
|
+
* @returns A handle representing the newly created grab interactable.
|
|
260
|
+
*/
|
|
261
|
+
static Create(entityHandle: Entity): boolean;
|
|
262
|
+
/**
|
|
263
|
+
* Destroys the grab interactable component on the given entity.
|
|
264
|
+
* @param entityHandle The entity whose grab interactable should be destroyed.
|
|
265
|
+
* @returns True if the component was successfully destroyed.
|
|
266
|
+
*/
|
|
267
|
+
static Destroy(entityHandle: Entity): boolean;
|
|
268
|
+
/**
|
|
269
|
+
* Checks if the specified entity has a grab interactable component.
|
|
270
|
+
* @param entityHandle The entity to check.
|
|
271
|
+
* @returns True if the component exists.
|
|
272
|
+
*/
|
|
273
|
+
static HasComponent(entityHandle: Entity): boolean;
|
|
274
|
+
/**
|
|
275
|
+
* Gets whether the grab interactable tracks position.
|
|
276
|
+
* @param entityHandle The target entity.
|
|
277
|
+
* @returns True if position tracking is enabled.
|
|
278
|
+
*/
|
|
279
|
+
static GetTrackPosition(entityHandle: Entity): boolean;
|
|
280
|
+
/**
|
|
281
|
+
* Enables or disables position tracking on the grab interactable.
|
|
282
|
+
* @param entityHandle The target entity.
|
|
283
|
+
* @param isTracking Whether to enable position tracking.
|
|
284
|
+
* @returns True if the change was applied.
|
|
285
|
+
*/
|
|
286
|
+
static SetTrackPosition(entityHandle: Entity, isTracking: boolean): boolean;
|
|
287
|
+
/**
|
|
288
|
+
* Gets whether the grab interactable tracks rotation.
|
|
289
|
+
* @param entityHandle The target entity.
|
|
290
|
+
* @returns True if rotation tracking is enabled.
|
|
291
|
+
*/
|
|
292
|
+
static GetTrackRotation(entityHandle: Entity): boolean;
|
|
293
|
+
/**
|
|
294
|
+
* Enables or disables rotation tracking on the grab interactable.
|
|
295
|
+
* @param entityHandle The target entity.
|
|
296
|
+
* @param isTracking Whether to enable rotation tracking.
|
|
297
|
+
* @returns True if the change was applied.
|
|
298
|
+
*/
|
|
299
|
+
static SetTrackRotation(entityHandle: Entity, isTracking: boolean): boolean;
|
|
300
|
+
/**
|
|
301
|
+
* Gets whether the grab interactable tracks scale.
|
|
302
|
+
* @param entityHandle The target entity.
|
|
303
|
+
* @returns True if scale tracking is enabled.
|
|
304
|
+
*/
|
|
305
|
+
static GetTrackScale(entityHandle: Entity): boolean;
|
|
306
|
+
/**
|
|
307
|
+
* Enables or disables scale tracking on the grab interactable.
|
|
308
|
+
* @param entityHandle The target entity.
|
|
309
|
+
* @param isTracking Whether to enable scale tracking.
|
|
310
|
+
* @returns True if the change was applied.
|
|
311
|
+
*/
|
|
312
|
+
static SetTrackScale(entityHandle: Entity, isTracking: boolean): boolean;
|
|
313
|
+
/**
|
|
314
|
+
* Gets whether the object should apply physics-based throw on detach.
|
|
315
|
+
* @param entityHandle The target entity.
|
|
316
|
+
* @returns True if throw-on-detach is enabled.
|
|
317
|
+
*/
|
|
318
|
+
static GetThrowOnDetach(entityHandle: Entity): boolean;
|
|
319
|
+
/**
|
|
320
|
+
* Enables or disables physics-based throwing on detach.
|
|
321
|
+
* @param entityHandle The target entity.
|
|
322
|
+
* @param enable Whether to enable throw-on-detach.
|
|
323
|
+
* @returns True if the setting was successfully changed.
|
|
324
|
+
*/
|
|
325
|
+
static SetThrowOnDetach(entityHandle: Entity, enable: boolean): boolean;
|
|
326
|
+
/**
|
|
327
|
+
* Gets the currently attached entity handle, if any.
|
|
328
|
+
* @param entityHandle The entity whose attachment is being queried.
|
|
329
|
+
* @returns True if the query was successful. The actual value is assumed returned via RPC side effect or callback.
|
|
330
|
+
*/
|
|
331
|
+
static GetAttachEntity(entityHandle: Entity): boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Sets the entity that should be used as the attachment target for this grab interactable.
|
|
334
|
+
* @param entityHandle The source grab interactable entity.
|
|
335
|
+
* @param attachEntityHandle The target entity to attach to.
|
|
336
|
+
* @returns True if the attachment was successfully updated.
|
|
337
|
+
*/
|
|
338
|
+
static SetAttachEntity(entityHandle: Entity, attachEntityHandle: Entity): boolean;
|
|
339
|
+
/**
|
|
340
|
+
* Registers a callback to be invoked when the object is selected (grabbed).
|
|
341
|
+
* @param entityHandle The entity to observe.
|
|
342
|
+
* @param onSelectEntered Callback function to invoke on select enter.
|
|
343
|
+
* @returns True if the callback was registered successfully.
|
|
344
|
+
*/
|
|
345
|
+
static AddSelectEnteredCallback(entityHandle: Entity, onSelectEntered: (interactableEntity: Entity, interactorEntity: Entity) => void): boolean;
|
|
346
|
+
/**
|
|
347
|
+
* Registers a callback to be invoked when the object is released (deselected).
|
|
348
|
+
* @param entityHandle The entity to observe.
|
|
349
|
+
* @param onSelectExited Callback function to invoke on select exit.
|
|
350
|
+
* @returns True if the callback was registered successfully.
|
|
351
|
+
*/
|
|
352
|
+
static AddSelectExitedCallback(entityHandle: Entity, onSelectExited: (interactableEntity: Entity, interactorEntity: Entity) => void): boolean;
|
|
353
|
+
/**
|
|
354
|
+
* Registers a callback to be invoked when the object is activated (e.g. trigger pressed).
|
|
355
|
+
* @param entityHandle The entity to observe.
|
|
356
|
+
* @param onActivated Callback function to invoke on activation.
|
|
357
|
+
* @returns True if the callback was registered successfully.
|
|
358
|
+
*/
|
|
359
|
+
static AddActivatedCallback(entityHandle: Entity, onActivated: (interactableEntity: Entity, interactorEntity: Entity) => void): boolean;
|
|
360
|
+
/**
|
|
361
|
+
* Registers a callback to be invoked when the object is deactivated (e.g. trigger released).
|
|
362
|
+
* @param entityHandle The entity to observe.
|
|
363
|
+
* @param onDeactivated Callback function to invoke on deactivation.
|
|
364
|
+
* @returns True if the callback was registered successfully.
|
|
365
|
+
*/
|
|
366
|
+
static AddDeactivatedCallback(entityHandle: Entity, onDeactivated: (interactableEntity: Entity, interactorEntity: Entity) => void): boolean;
|
|
367
|
+
}
|
|
368
|
+
export declare class StateSync {
|
|
369
|
+
static stateMap: Map<string, object>;
|
|
370
|
+
static GetNetworkID(): string;
|
|
371
|
+
static CreateNetworkState<T extends object>(key: string, initial: T, onStateChange?: (prop: string, value: any) => void): T;
|
|
372
|
+
static IsStateAuthority(): boolean;
|
|
373
|
+
static GetPlayerId(): number;
|
|
374
|
+
}
|
|
375
|
+
export type ColliderHandle = number;
|
|
376
|
+
export declare class ColliderManager {
|
|
377
|
+
static CreateBox(entityHandle: Entity): ColliderHandle;
|
|
378
|
+
static CreateSphere(entityHandle: Entity): ColliderHandle;
|
|
379
|
+
static CreateCapsule(entityHandle: Entity): ColliderHandle;
|
|
380
|
+
static Destroy(entityHandle: Entity, colliderHandle: ColliderHandle): boolean;
|
|
381
|
+
static HasComponent(entityHandle: Entity, colliderHandle: ColliderHandle): boolean;
|
|
382
|
+
static GetGameObject(entityHandle: Entity): ColliderHandle;
|
|
383
|
+
static GetBoxColliderCenter(colliderHandle: ColliderHandle): vec3;
|
|
384
|
+
static SetBoxColliderCenter(colliderHandle: ColliderHandle, center: vec3): boolean;
|
|
385
|
+
static GetBoxColliderSize(colliderHandle: ColliderHandle): vec3;
|
|
386
|
+
static SetBoxColliderSize(colliderHandle: ColliderHandle, size: vec3): boolean;
|
|
387
|
+
static GetSphereColliderCenter(colliderHandle: ColliderHandle): vec3;
|
|
388
|
+
static SetSphereColliderCenter(colliderHandle: ColliderHandle, center: vec3): boolean;
|
|
389
|
+
static GetSphereColliderRadius(colliderHandle: ColliderHandle): number;
|
|
390
|
+
static SetSphereColliderRadius(colliderHandle: ColliderHandle, radius: number): boolean;
|
|
391
|
+
static GetCapsuleColliderCenter(colliderHandle: ColliderHandle): vec3;
|
|
392
|
+
static SetCapsuleColliderCenter(colliderHandle: ColliderHandle, center: vec3): boolean;
|
|
393
|
+
static GetCapsuleColliderRadius(colliderHandle: ColliderHandle): number;
|
|
394
|
+
static SetCapsuleColliderRadius(colliderHandle: ColliderHandle, radius: number): boolean;
|
|
395
|
+
static GetCapsuleColliderHeight(colliderHandle: ColliderHandle): number;
|
|
396
|
+
static SetCapsuleColliderHeight(colliderHandle: ColliderHandle, height: number): boolean;
|
|
397
|
+
static GetIsTrigger(entityHandle: Entity): Boolean;
|
|
398
|
+
static SetIsTrigger(colliderHandle: Entity, isTrigger: boolean): Boolean;
|
|
399
|
+
static AddTriggerEnterCallback(entityHandle: Entity, onTriggerEnter: () => void): boolean;
|
|
400
|
+
static AddTriggerExitCallback(entityHandle: Entity, onTriggerExit: () => void): boolean;
|
|
401
|
+
static AddTriggerStayCallback(entityHandle: Entity, onTriggerStay: () => void): boolean;
|
|
402
|
+
}
|
|
403
|
+
export declare class RigidbodyManager {
|
|
404
|
+
static Create(entityHandle: Entity): boolean;
|
|
405
|
+
static Destroy(entityHandle: Entity): boolean;
|
|
406
|
+
static HasComponent(entityHandle: Entity): boolean;
|
|
407
|
+
static GetIsKinematic(entityHandle: Entity): boolean;
|
|
408
|
+
static SetIsKinematic(entityHandle: Entity, isKinematic: boolean): boolean;
|
|
409
|
+
static GetUseGravity(entityHandle: Entity): boolean;
|
|
410
|
+
static SetUseGravity(entityHandle: Entity, useGravity: boolean): boolean;
|
|
411
|
+
static GetMass(entityHandle: Entity): number;
|
|
412
|
+
static SetMass(entityHandle: Entity, mass: number): boolean;
|
|
413
|
+
static GetLinearDamping(entityHandle: Entity): number;
|
|
414
|
+
static SetLinearDamping(entityHandle: Entity, linearDamping: number): boolean;
|
|
415
|
+
static GetAngularDamping(entityHandle: Entity): number;
|
|
416
|
+
static SetAngularDamping(entityHandle: Entity, angularDamping: number): boolean;
|
|
417
|
+
}
|
|
418
|
+
export type MaterialHandle = number;
|
|
419
|
+
export declare enum ShaderType {
|
|
420
|
+
URP_LIT = "Universal Render Pipeline/Lit"
|
|
421
|
+
}
|
|
422
|
+
export declare enum ShaderProperties {
|
|
423
|
+
/** 2D Texture */
|
|
424
|
+
BaseMap = "_BaseMap",
|
|
425
|
+
/** vec4 [0.0, 1.0] */
|
|
426
|
+
BaseColor = "_BaseColor",
|
|
427
|
+
/** float [0.0, 1.0] */
|
|
428
|
+
Cutoff = "_Cutoff",
|
|
429
|
+
/** float [0.0, 1.0] */
|
|
430
|
+
Smoothness = "_Smoothness",
|
|
431
|
+
/** float */
|
|
432
|
+
SmoothnessTextureChannel = "_SmoothnessTextureChannel",
|
|
433
|
+
/** float [0.0, 1.0] */
|
|
434
|
+
Metallic = "_Metallic",
|
|
435
|
+
/** 2D Texture */
|
|
436
|
+
MetallicGlossMap = "_MetallicGlossMap",
|
|
437
|
+
/** vec3 [0.0, 1.0] */
|
|
438
|
+
SpecColor = "_SpecColor",
|
|
439
|
+
/** 2D Texture */
|
|
440
|
+
SpecGlossMap = "_SpecGlossMap",
|
|
441
|
+
/** float */
|
|
442
|
+
SpecularHighlights = "_SpecularHighlights",
|
|
443
|
+
/** float */
|
|
444
|
+
EnvironmentReflections = "_EnvironmentReflections",
|
|
445
|
+
/** float */
|
|
446
|
+
BumpScale = "_BumpScale",
|
|
447
|
+
/** 2D Texture */
|
|
448
|
+
BumpMap = "_BumpMap",
|
|
449
|
+
/** float [0.005, 0.08] */
|
|
450
|
+
Parallax = "_Parallax",
|
|
451
|
+
/** 2D Texture */
|
|
452
|
+
ParallaxMap = "_ParallaxMap",
|
|
453
|
+
/** float [0.0, 1.0] */
|
|
454
|
+
OcclusionStrength = "_OcclusionStrength",
|
|
455
|
+
/** 2D Texture */
|
|
456
|
+
OcclusionMap = "_OcclusionMap",
|
|
457
|
+
/** vec3 [0.0, 1.0] */
|
|
458
|
+
EmissionColor = "_EmissionColor",
|
|
459
|
+
/** 2D Texture */
|
|
460
|
+
EmissionMap = "_EmissionMap",
|
|
461
|
+
/** 2D Texture */
|
|
462
|
+
DetailMask = "_DetailMask",
|
|
463
|
+
/** float [0.0, 2.0] */
|
|
464
|
+
DetailAlbedoMapScale = "_DetailAlbedoMapScale",
|
|
465
|
+
/** 2D Texture */
|
|
466
|
+
DetailAlbedoMap = "_DetailAlbedoMap",
|
|
467
|
+
/** float [0.0, 2.0] */
|
|
468
|
+
DetailNormalMapScale = "_DetailNormalMapScale",
|
|
469
|
+
/** 2D Texture */
|
|
470
|
+
DetailNormalMap = "_DetailNormalMap"
|
|
471
|
+
}
|
|
472
|
+
export declare class MaterialManager {
|
|
473
|
+
/**
|
|
474
|
+
* Create a new material with the specified shader
|
|
475
|
+
* @param shader The name of the shader to use
|
|
476
|
+
* @returns The material handle
|
|
477
|
+
*/
|
|
478
|
+
static Create(shader: ShaderType): MaterialHandle;
|
|
479
|
+
/**
|
|
480
|
+
* Create a new material and attach it to a renderable component
|
|
481
|
+
* @param shader The name of the shader to use
|
|
482
|
+
* @param entity The entity with the renderable component
|
|
483
|
+
* @param submeshIndex The submesh index to attach to (default: 0)
|
|
484
|
+
* @returns The material handle
|
|
485
|
+
*/
|
|
486
|
+
static Create(shader: ShaderType, entity: Entity, submeshIndex?: number): MaterialHandle;
|
|
487
|
+
/**
|
|
488
|
+
* Destroy a material
|
|
489
|
+
* @param handle The material handle to destroy
|
|
490
|
+
* @returns boolean indicating success
|
|
491
|
+
*/
|
|
492
|
+
static Destroy(handle: MaterialHandle): boolean;
|
|
493
|
+
/**
|
|
494
|
+
* Create a material instance
|
|
495
|
+
* @param handle The material handle to create an instance from
|
|
496
|
+
* @returns The material instance handle
|
|
497
|
+
*/
|
|
498
|
+
static CreateInstance(handle: MaterialHandle): MaterialHandle;
|
|
499
|
+
/**
|
|
500
|
+
* Set a float property on the material
|
|
501
|
+
* @param handle The material handle
|
|
502
|
+
* @param prop The property name
|
|
503
|
+
* @param value The float value
|
|
504
|
+
* @returns boolean indicating success
|
|
505
|
+
*/
|
|
506
|
+
static SetFloat(handle: MaterialHandle, prop: ShaderProperties, value: number): boolean;
|
|
507
|
+
/**
|
|
508
|
+
* Set a vector property on the material
|
|
509
|
+
* @param handle The material handle
|
|
510
|
+
* @param prop The property name
|
|
511
|
+
* @param value vec4 value
|
|
512
|
+
* @returns boolean indicating success
|
|
513
|
+
*/
|
|
514
|
+
static SetVector(handle: MaterialHandle, prop: ShaderProperties, value: vec4): boolean;
|
|
515
|
+
/**
|
|
516
|
+
* Set a color property on the material
|
|
517
|
+
* @param handle The material handle
|
|
518
|
+
* @param prop The property name
|
|
519
|
+
* @param rgba vec4 color [0.0, 1.0]
|
|
520
|
+
* @returns boolean indicating success
|
|
521
|
+
*/
|
|
522
|
+
static SetColor(handle: MaterialHandle, prop: ShaderProperties, rgba: vec4): boolean;
|
|
523
|
+
/**
|
|
524
|
+
* Set a texture property on the material
|
|
525
|
+
* @param handle The material handle
|
|
526
|
+
* @param prop The property name
|
|
527
|
+
* @param tex The texture handle
|
|
528
|
+
* @returns boolean indicating success
|
|
529
|
+
*/
|
|
530
|
+
static SetTexture(handle: MaterialHandle, prop: ShaderProperties, tex: number): boolean;
|
|
531
|
+
/**
|
|
532
|
+
* Get a float property from the material
|
|
533
|
+
* @param handle The material handle
|
|
534
|
+
* @param prop The property name
|
|
535
|
+
* @returns The float value
|
|
536
|
+
*/
|
|
537
|
+
static GetFloat(handle: MaterialHandle, prop: ShaderProperties): number;
|
|
538
|
+
/**
|
|
539
|
+
* Get a color property from the material
|
|
540
|
+
* @param handle The material handle
|
|
541
|
+
* @param prop The property name
|
|
542
|
+
* @returns The color as a string
|
|
543
|
+
*/
|
|
544
|
+
static GetColor(handle: MaterialHandle, prop: ShaderProperties): string;
|
|
545
|
+
}
|
|
546
|
+
export type TextureHandle = number;
|
|
547
|
+
export declare enum TextureFormat {
|
|
548
|
+
Alpha8 = 1,
|
|
549
|
+
ARGB4444 = 2,
|
|
550
|
+
RGB24 = 3,
|
|
551
|
+
RGBA32 = 4,
|
|
552
|
+
ARGB32 = 5,
|
|
553
|
+
RGB565 = 7,
|
|
554
|
+
R16 = 9,
|
|
555
|
+
DXT1 = 10,
|
|
556
|
+
DXT5 = 12
|
|
557
|
+
}
|
|
558
|
+
export declare class TextureManager {
|
|
559
|
+
/**
|
|
560
|
+
* Create a 2D texture
|
|
561
|
+
* @param width The texture width
|
|
562
|
+
* @param height The texture height
|
|
563
|
+
* @param format The texture format
|
|
564
|
+
* @returns The texture handle
|
|
565
|
+
*/
|
|
566
|
+
static Create2D(width: number, height: number, format: TextureFormat): TextureHandle;
|
|
567
|
+
/**
|
|
568
|
+
* Create a 2D texture and attach it to a material
|
|
569
|
+
* @param width The texture width
|
|
570
|
+
* @param height The texture height
|
|
571
|
+
* @param format The texture format
|
|
572
|
+
* @param materialHandle The material handle to attach to
|
|
573
|
+
* @param propertyName The material property name
|
|
574
|
+
* @returns The texture handle
|
|
575
|
+
*/
|
|
576
|
+
static Create2DForMaterial(width: number, height: number, format: TextureFormat, materialHandle: MaterialHandle, propertyName: string): TextureHandle;
|
|
577
|
+
/**
|
|
578
|
+
* Create a render texture
|
|
579
|
+
* @param width The texture width
|
|
580
|
+
* @param height The texture height
|
|
581
|
+
* @param depth The texture depth
|
|
582
|
+
* @param format The texture format
|
|
583
|
+
* @returns The texture handle
|
|
584
|
+
*/
|
|
585
|
+
static CreateRenderTexture(width: number, height: number, depth: number, format: TextureFormat): TextureHandle;
|
|
586
|
+
/**
|
|
587
|
+
* Destroy a texture
|
|
588
|
+
* @param handle The texture handle to destroy
|
|
589
|
+
* @returns boolean indicating success
|
|
590
|
+
*/
|
|
591
|
+
static Destroy(handle: TextureHandle): boolean;
|
|
592
|
+
/**
|
|
593
|
+
* Set raw RGBA iamge for the texture
|
|
594
|
+
* @param handle The texture handle
|
|
595
|
+
* @param rgbaDataJson RGBA values
|
|
596
|
+
* @param width The texture width
|
|
597
|
+
* @param height The texture height
|
|
598
|
+
* @returns boolean indicating success
|
|
599
|
+
*/
|
|
600
|
+
static LoadRawTextureData(handle: TextureHandle, base64Rgba: ArrayBufferLike, width: number, height: number): boolean;
|
|
601
|
+
/**
|
|
602
|
+
* Loads PNG/JPG image byte array into a texture.
|
|
603
|
+
* @param handle The texture handle
|
|
604
|
+
* @param imageDataJson JSON string with comma-separated RGBA values
|
|
605
|
+
* @returns boolean indicating success
|
|
606
|
+
*/
|
|
607
|
+
static LoadImage(handle: TextureHandle, image: ArrayBufferLike): boolean;
|
|
608
|
+
/**
|
|
609
|
+
* Loads PNG/JPG image byte array into a texture.
|
|
610
|
+
* @param handle The texture handle
|
|
611
|
+
* @param imageDataJson JSON string with comma-separated RGBA values
|
|
612
|
+
* @returns boolean indicating success
|
|
613
|
+
*/
|
|
614
|
+
static LoadImageBase64(handle: TextureHandle, base64Image: string): boolean;
|
|
615
|
+
/**
|
|
616
|
+
* Set the filter mode for the texture
|
|
617
|
+
* @param handle The texture handle
|
|
618
|
+
* @param mode The filter mode
|
|
619
|
+
* @returns boolean indicating success
|
|
620
|
+
*/
|
|
621
|
+
static SetFilterMode(handle: TextureHandle, mode: TextureFilterMode): boolean;
|
|
622
|
+
/**
|
|
623
|
+
* Set the wrap mode for the texture
|
|
624
|
+
* @param handle The texture handle
|
|
625
|
+
* @param wrapMode The wrap mode
|
|
626
|
+
* @returns boolean indicating success
|
|
627
|
+
*/
|
|
628
|
+
static SetWrapMode(handle: TextureHandle, wrapMode: TextureWrapMode): boolean;
|
|
629
|
+
}
|
|
630
|
+
export declare enum TextureFilterMode {
|
|
631
|
+
NEAREST = 0,
|
|
632
|
+
LINEAR = 1,
|
|
633
|
+
NEAREST_MIPMAP_NEAREST = 2,
|
|
634
|
+
LINEAR_MIPMAP_NEAREST = 3,
|
|
635
|
+
NEAREST_MIPMAP_LINEAR = 4,
|
|
636
|
+
LINEAR_MIPMAP_LINEAR = 5
|
|
637
|
+
}
|
|
638
|
+
export declare enum TextureWrapMode {
|
|
639
|
+
CLAMP_TO_EDGE = 0,
|
|
640
|
+
REPEAT = 1,
|
|
641
|
+
MIRRORED_REPEAT = 2
|
|
642
|
+
}
|
|
643
|
+
export declare class CameraManager {
|
|
644
|
+
/**
|
|
645
|
+
* Create a Camera component and attach it to the specified entity
|
|
646
|
+
* @param entity The entity to attach the camera to
|
|
647
|
+
* @returns boolean indicating success
|
|
648
|
+
*/
|
|
649
|
+
static Create(entity: Entity): boolean;
|
|
650
|
+
/**
|
|
651
|
+
* Destroy the Camera component from the specified entity
|
|
652
|
+
* @param entity The entity to remove the camera from
|
|
653
|
+
* @returns boolean indicating success
|
|
654
|
+
*/
|
|
655
|
+
static Destroy(entity: Entity): boolean;
|
|
656
|
+
/**
|
|
657
|
+
* Check if the entity has a Camera component
|
|
658
|
+
* @param entity The entity to check
|
|
659
|
+
* @returns boolean indicating if camera component exists
|
|
660
|
+
*/
|
|
661
|
+
static HasComponent(entity: Entity): boolean;
|
|
662
|
+
/**
|
|
663
|
+
* Set the projection parameters for the camera
|
|
664
|
+
* @param entity The entity with the camera component
|
|
665
|
+
* @param projectionType Type of projection
|
|
666
|
+
* @param fov Field of view
|
|
667
|
+
* @param aspect Aspect ratio
|
|
668
|
+
* @param near Near plane
|
|
669
|
+
* @param far Far plane
|
|
670
|
+
* @returns boolean indicating success
|
|
671
|
+
*/
|
|
672
|
+
static SetProjection(entity: Entity, projectionType: number, fov: number, aspect: number, near: number, far: number): boolean;
|
|
673
|
+
/**
|
|
674
|
+
* Set orthographic projection parameters
|
|
675
|
+
* @param entity The entity with the camera component
|
|
676
|
+
* @param left Left plane
|
|
677
|
+
* @param right Right plane
|
|
678
|
+
* @param bottom Bottom plane
|
|
679
|
+
* @param top Top plane
|
|
680
|
+
* @param near Near plane
|
|
681
|
+
* @param far Far plane
|
|
682
|
+
* @returns boolean indicating success
|
|
683
|
+
*/
|
|
684
|
+
static SetOrthographic(entity: Entity, left: number, right: number, bottom: number, top: number, near: number, far: number): boolean;
|
|
685
|
+
/**
|
|
686
|
+
* Make the camera look at a target point
|
|
687
|
+
* @param entity The entity with the camera component
|
|
688
|
+
* @param targetX Target X coordinate
|
|
689
|
+
* @param targetY Target Y coordinate
|
|
690
|
+
* @param targetZ Target Z coordinate
|
|
691
|
+
* @param upX Up vector X
|
|
692
|
+
* @param upY Up vector Y
|
|
693
|
+
* @param upZ Up vector Z
|
|
694
|
+
* @param worldUpX World up X
|
|
695
|
+
* @param worldUpY World up Y
|
|
696
|
+
* @param worldUpZ World up Z
|
|
697
|
+
* @returns boolean indicating success
|
|
698
|
+
*/
|
|
699
|
+
static LookAt(entity: Entity, targetX: number, targetY: number, targetZ: number, upX: number, upY: number, upZ: number, worldUpX: number, worldUpY: number, worldUpZ: number): boolean;
|
|
700
|
+
/**
|
|
701
|
+
* Set the culling mask for the camera
|
|
702
|
+
* @param entity The entity with the camera component
|
|
703
|
+
* @param mask The culling mask
|
|
704
|
+
* @returns boolean indicating success
|
|
705
|
+
*/
|
|
706
|
+
static SetCullingMask(entity: Entity, mask: number): boolean;
|
|
707
|
+
/**
|
|
708
|
+
* Set the render texture for the camera
|
|
709
|
+
* @param entity The entity with the camera component
|
|
710
|
+
* @param textureHandle The render texture handle
|
|
711
|
+
* @returns boolean indicating success
|
|
712
|
+
*/
|
|
713
|
+
static SetRenderTexture(entity: Entity, textureHandle: TextureHandle): boolean;
|
|
714
|
+
}
|
|
715
|
+
export declare class LightManager {
|
|
716
|
+
/**
|
|
717
|
+
* Create a Light component and attach it to the specified entity
|
|
718
|
+
* @param entity The entity to attach the light to
|
|
719
|
+
* @param type The type of light to create
|
|
720
|
+
* @returns boolean indicating success
|
|
721
|
+
*/
|
|
722
|
+
static Create(entity: Entity, type: LightType): boolean;
|
|
723
|
+
/**
|
|
724
|
+
* Destroy the Light component from the specified entity
|
|
725
|
+
* @param entity The entity to remove the light from
|
|
726
|
+
* @returns boolean indicating success
|
|
727
|
+
*/
|
|
728
|
+
static Destroy(entity: Entity): boolean;
|
|
729
|
+
/**
|
|
730
|
+
* Check if the entity has a Light component
|
|
731
|
+
* @param entity The entity to check
|
|
732
|
+
* @returns boolean indicating if light component exists
|
|
733
|
+
*/
|
|
734
|
+
static HasComponent(entity: Entity): boolean;
|
|
735
|
+
/**
|
|
736
|
+
* Set the type of light
|
|
737
|
+
* @param entity The entity with the light component
|
|
738
|
+
* @param type The light type
|
|
739
|
+
* @returns boolean indicating success
|
|
740
|
+
*/
|
|
741
|
+
static SetType(entity: Entity, type: LightType): boolean;
|
|
742
|
+
/**
|
|
743
|
+
* Set the color of the light
|
|
744
|
+
* @param entity The entity with the light component
|
|
745
|
+
* @param r Red component (0-1)
|
|
746
|
+
* @param g Green component (0-1)
|
|
747
|
+
* @param b Blue component (0-1)
|
|
748
|
+
* @returns boolean indicating success
|
|
749
|
+
*/
|
|
750
|
+
static SetColor(entity: Entity, rgb: vec3): boolean;
|
|
751
|
+
/**
|
|
752
|
+
* Set the intensity of the light
|
|
753
|
+
* @param entity The entity with the light component
|
|
754
|
+
* @param intensity The light intensity
|
|
755
|
+
* @returns boolean indicating success
|
|
756
|
+
*/
|
|
757
|
+
static SetIntensity(entity: Entity, intensity: number): boolean;
|
|
758
|
+
/**
|
|
759
|
+
* Set the range of the light
|
|
760
|
+
* @param entity The entity with the light component
|
|
761
|
+
* @param range The light range
|
|
762
|
+
* @returns boolean indicating success
|
|
763
|
+
*/
|
|
764
|
+
static SetRange(entity: Entity, range: number): boolean;
|
|
765
|
+
/**
|
|
766
|
+
* Set the spot angle for spot lights
|
|
767
|
+
* @param entity The entity with the light component
|
|
768
|
+
* @param angle The spot angle
|
|
769
|
+
* @param asDegrees Whether the angle is in degrees (default: true)
|
|
770
|
+
* @returns boolean indicating success
|
|
771
|
+
*/
|
|
772
|
+
static SetSpotAngle(entity: Entity, angle: number, asDegrees?: boolean): boolean;
|
|
773
|
+
/**
|
|
774
|
+
* Set the shadow mode for the light
|
|
775
|
+
* @param entity The entity with the light component
|
|
776
|
+
* @param mode The shadow mode
|
|
777
|
+
* @returns boolean indicating success
|
|
778
|
+
*/
|
|
779
|
+
static SetShadows(entity: Entity, mode: LightShadowMode): boolean;
|
|
780
|
+
/**
|
|
781
|
+
* Set the culling mask for the light
|
|
782
|
+
* @param entity The entity with the light component
|
|
783
|
+
* @param mask The culling mask
|
|
784
|
+
* @returns boolean indicating success
|
|
785
|
+
*/
|
|
786
|
+
static SetCullingMask(entity: Entity, mask: number): boolean;
|
|
787
|
+
}
|
|
788
|
+
export declare enum LightShadowMode {
|
|
789
|
+
NoShadows = 0,
|
|
790
|
+
Hard = 1,
|
|
791
|
+
Soft = 2
|
|
792
|
+
}
|
|
793
|
+
export declare enum LightType {
|
|
794
|
+
Spot = 0,
|
|
795
|
+
Directional = 1,
|
|
796
|
+
Point = 2,
|
|
797
|
+
Area = 3
|
|
798
|
+
}
|
|
799
|
+
export type MeshHandle = number;
|
|
800
|
+
export declare class MeshManager {
|
|
801
|
+
/**
|
|
802
|
+
* Create a new mesh
|
|
803
|
+
* @returns The mesh handle
|
|
804
|
+
*/
|
|
805
|
+
static Create(): MeshHandle;
|
|
806
|
+
/**
|
|
807
|
+
* Create a new mesh and attach it to a renderable component
|
|
808
|
+
* @param entity The entity with the renderable component
|
|
809
|
+
* @returns The mesh handle
|
|
810
|
+
*/
|
|
811
|
+
static Create(entity: Entity): MeshHandle;
|
|
812
|
+
/**
|
|
813
|
+
* Destroy a mesh
|
|
814
|
+
* @param handle The mesh handle to destroy
|
|
815
|
+
* @returns boolean indicating success
|
|
816
|
+
*/
|
|
817
|
+
static Destroy(handle: MeshHandle): boolean;
|
|
818
|
+
/**
|
|
819
|
+
* Set the vertices for the mesh
|
|
820
|
+
* @param handle The mesh handle
|
|
821
|
+
* @param vertices Array of vertex positions
|
|
822
|
+
* @returns boolean indicating success
|
|
823
|
+
*/
|
|
824
|
+
static SetVertices(handle: MeshHandle, vertices: vec3[]): boolean;
|
|
825
|
+
/**
|
|
826
|
+
* Set the vertices for the mesh
|
|
827
|
+
* @param handle The mesh handle
|
|
828
|
+
* @param base64Vertices Array of vertex positions encoded as a base64 string
|
|
829
|
+
* @returns boolean indicating success
|
|
830
|
+
*/
|
|
831
|
+
static SetVertices(handle: MeshHandle, base64Vertices: string): boolean;
|
|
832
|
+
/**
|
|
833
|
+
* Set the triangles (indices) for the mesh
|
|
834
|
+
* @param handle The mesh handle
|
|
835
|
+
* @param indices Array of triangle indices
|
|
836
|
+
* @returns boolean indicating success
|
|
837
|
+
*/
|
|
838
|
+
static SetTriangles(handle: MeshHandle, indices: vec3[]): boolean;
|
|
839
|
+
/**
|
|
840
|
+
* Set the triangles (indices) for the mesh
|
|
841
|
+
* @param handle The mesh handle
|
|
842
|
+
* @param base64Indices Array of triangle indices encoeded as a base64 string
|
|
843
|
+
* @returns boolean indicating success
|
|
844
|
+
*/
|
|
845
|
+
static SetTriangles(handle: MeshHandle, base64Indices: string): boolean;
|
|
846
|
+
static SetUVs(handle: MeshHandle, uvs: vec2[]): boolean;
|
|
847
|
+
static SetUVs(handle: MeshHandle, base64Uvs: string): boolean;
|
|
848
|
+
static SetNormals(handle: MeshHandle, normals: vec3[]): boolean;
|
|
849
|
+
static SetNormals(handle: MeshHandle, base64Normals: string): boolean;
|
|
850
|
+
/**
|
|
851
|
+
* Recalculate normals for the mesh
|
|
852
|
+
* @param handle The mesh handle
|
|
853
|
+
* @returns boolean indicating success
|
|
854
|
+
*/
|
|
855
|
+
static RecalcNormals(handle: MeshHandle): boolean;
|
|
856
|
+
/**
|
|
857
|
+
* Recalculate bounds for the mesh
|
|
858
|
+
* @param handle The mesh handle
|
|
859
|
+
* @returns boolean indicating success
|
|
860
|
+
*/
|
|
861
|
+
static RecalcBounds(handle: MeshHandle): boolean;
|
|
862
|
+
}
|
|
863
|
+
export declare function NewCubeMesh(): number;
|
|
864
|
+
export declare function NewQuadMesh(): number;
|
|
865
|
+
export declare class RenderableManager {
|
|
866
|
+
/**
|
|
867
|
+
* Create a renderable component and attach it to the specified entity
|
|
868
|
+
* @param entity The entity to attach the renderable component to
|
|
869
|
+
* @returns boolean indicating success
|
|
870
|
+
*/
|
|
871
|
+
static Create(entity: Entity): boolean;
|
|
872
|
+
/**
|
|
873
|
+
* Destroy the Renderable component on this entity.
|
|
874
|
+
* @param entityHandle The entity to remove the renderable component from
|
|
875
|
+
* @returns boolean indicating success
|
|
876
|
+
*/
|
|
877
|
+
static Destroy(entityHandle: Entity): boolean;
|
|
878
|
+
/**
|
|
879
|
+
* Returns whether this entity currently has a Renderable.
|
|
880
|
+
* @param entityHandle The entity to check
|
|
881
|
+
* @returns boolean indicating if renderable component exists
|
|
882
|
+
*/
|
|
883
|
+
static HasComponent(entityHandle: Entity): boolean;
|
|
884
|
+
/**
|
|
885
|
+
* Set the mesh for the renderable component
|
|
886
|
+
* @param entityHandle The entity with the renderable component
|
|
887
|
+
* @param meshHandle The mesh handle to attach
|
|
888
|
+
* @returns boolean indicating success
|
|
889
|
+
*/
|
|
890
|
+
static SetMesh(entityHandle: Entity, meshHandle: number): boolean;
|
|
891
|
+
/**
|
|
892
|
+
* Set the material for the renderable component
|
|
893
|
+
* @param entityHandle The entity with the renderable component
|
|
894
|
+
* @param materialHandle The material handle to attach
|
|
895
|
+
* @param index The submesh index (default: 0)
|
|
896
|
+
* @returns boolean indicating success
|
|
897
|
+
*/
|
|
898
|
+
static SetMaterial(entityHandle: Entity, materialHandle: number, index?: number): boolean;
|
|
899
|
+
/**
|
|
900
|
+
* Set the layer mask on this Renderable (bitmask of visible layers).
|
|
901
|
+
* @param entityHandle The entity with the renderable component
|
|
902
|
+
* @param layerMask The layer mask
|
|
903
|
+
* @returns boolean indicating success
|
|
904
|
+
*/
|
|
905
|
+
static SetLayerMask(entityHandle: Entity, layerMask: number): boolean;
|
|
906
|
+
/**
|
|
907
|
+
* Enable or disable receiving shadows on this Renderable.
|
|
908
|
+
* @param entityHandle The entity with the renderable component
|
|
909
|
+
* @param receive Whether to receive shadows
|
|
910
|
+
* @returns boolean indicating success
|
|
911
|
+
*/
|
|
912
|
+
static SetReceiveShadows(entityHandle: Entity, receive: boolean): boolean;
|
|
913
|
+
/**
|
|
914
|
+
* Control shadow‐casting mode.
|
|
915
|
+
* 0 = Off, 1 = On, 2 = TwoSided, 3 = ShadowsOnly
|
|
916
|
+
* @param entityHandle The entity with the renderable component
|
|
917
|
+
* @param shadowMode The shadow casting mode
|
|
918
|
+
* @returns boolean indicating success
|
|
919
|
+
*/
|
|
920
|
+
static SetCastShadows(entityHandle: Entity, shadowMode: number): boolean;
|
|
921
|
+
/**
|
|
922
|
+
* Enable or disable frustum‐culling on this Renderable.
|
|
923
|
+
* @param entityHandle The entity with the renderable component
|
|
924
|
+
* @param enabled Whether to enable culling
|
|
925
|
+
* @returns boolean indicating success
|
|
926
|
+
*/
|
|
927
|
+
static SetCulling(entityHandle: Entity, enabled: boolean): boolean;
|
|
928
|
+
}
|
|
929
|
+
export declare class RendererManager {
|
|
930
|
+
/**
|
|
931
|
+
* Filament: Renderer::getDefaultCameraEntity()
|
|
932
|
+
* Unity RPC not yet implemented; please register a CameraManager method.
|
|
933
|
+
* @returns The default camera entity handle
|
|
934
|
+
*/
|
|
935
|
+
static GetDefaultCameraEntity(): number;
|
|
936
|
+
/**
|
|
937
|
+
* Filament: Renderer::getXRCameras()
|
|
938
|
+
* Unity RPC not yet implemented.
|
|
939
|
+
* @returns Array of XR camera entity handles
|
|
940
|
+
*/
|
|
941
|
+
static GetXRCameras(): number[];
|
|
942
|
+
/**
|
|
943
|
+
* Destroy a material instance (mimics Filament::Renderer::destroyMaterialInstance)
|
|
944
|
+
* @param instanceHandle The material instance handle to destroy
|
|
945
|
+
* @returns boolean indicating success
|
|
946
|
+
*/
|
|
947
|
+
static DestroyMaterialInstance(instanceHandle: number): boolean;
|
|
948
|
+
/**
|
|
949
|
+
* Destroy a render-target (in Unity, render textures)
|
|
950
|
+
* @param rtHandle The render target handle to destroy
|
|
951
|
+
* @returns boolean indicating success
|
|
952
|
+
*/
|
|
953
|
+
static DestroyRenderTarget(rtHandle: number): boolean;
|
|
954
|
+
/**
|
|
955
|
+
* Destroy a skybox (in Unity, just a material)
|
|
956
|
+
* @param skyboxMatHandle The skybox material handle to destroy
|
|
957
|
+
* @returns boolean indicating success
|
|
958
|
+
*/
|
|
959
|
+
static DestroySkybox(skyboxMatHandle: number): boolean;
|
|
960
|
+
/**
|
|
961
|
+
* Destroy an indirect light (no direct Unity equivalent)
|
|
962
|
+
* @param ilHandle The indirect light handle to destroy
|
|
963
|
+
* @returns boolean indicating success
|
|
964
|
+
*/
|
|
965
|
+
static DestroyIndirectLight(ilHandle: number): boolean;
|
|
966
|
+
/**
|
|
967
|
+
* Wraps Scene_SetSkybox
|
|
968
|
+
* @param sceneHandle The scene handle
|
|
969
|
+
* @param skyboxMatHandle The skybox material handle
|
|
970
|
+
* @returns boolean indicating success
|
|
971
|
+
*/
|
|
972
|
+
static SetSkybox(sceneHandle: number, skyboxMatHandle: number): boolean;
|
|
973
|
+
/**
|
|
974
|
+
* Wraps Scene_SetAmbientLight
|
|
975
|
+
* @param sceneHandle The scene handle
|
|
976
|
+
* @param r Red component (0-1)
|
|
977
|
+
* @param g Green component (0-1)
|
|
978
|
+
* @param b Blue component (0-1)
|
|
979
|
+
* @param intensity The ambient light intensity
|
|
980
|
+
* @returns boolean indicating success
|
|
981
|
+
*/
|
|
982
|
+
static SetAmbientLight(sceneHandle: number, r: number, g: number, b: number, intensity: number): boolean;
|
|
983
|
+
/**
|
|
984
|
+
* Wraps Scene_SetFog
|
|
985
|
+
* @param sceneHandle The scene handle
|
|
986
|
+
* @param enabled Whether fog is enabled
|
|
987
|
+
* @param mode The fog mode
|
|
988
|
+
* @param density The fog density
|
|
989
|
+
* @param start The fog start distance
|
|
990
|
+
* @param end The fog end distance
|
|
991
|
+
* @returns boolean indicating success
|
|
992
|
+
*/
|
|
993
|
+
static SetFog(sceneHandle: number, enabled: boolean, mode: number, density: number, start: number, end: number): boolean;
|
|
994
|
+
}
|
|
995
|
+
export type SceneHandle = number;
|
|
996
|
+
export declare class SceneManager {
|
|
997
|
+
/**
|
|
998
|
+
* Get the default scene handle
|
|
999
|
+
* @returns The default scene handle
|
|
1000
|
+
*/
|
|
1001
|
+
static GetDefault(): SceneHandle;
|
|
1002
|
+
/**
|
|
1003
|
+
* Set the skybox for the scene
|
|
1004
|
+
* @param sceneHandle The scene handle
|
|
1005
|
+
* @param skyboxHandle The skybox material handle
|
|
1006
|
+
* @returns boolean indicating success
|
|
1007
|
+
*/
|
|
1008
|
+
static SetSkybox(sceneHandle: SceneHandle, skyboxHandle: number): boolean;
|
|
1009
|
+
/**
|
|
1010
|
+
* Set the ambient light for the scene
|
|
1011
|
+
* @param sceneHandle The scene handle
|
|
1012
|
+
* @param r Red component (0-1)
|
|
1013
|
+
* @param g Green component (0-1)
|
|
1014
|
+
* @param b Blue component (0-1)
|
|
1015
|
+
* @param intensity The ambient light intensity
|
|
1016
|
+
* @returns boolean indicating success
|
|
1017
|
+
*/
|
|
1018
|
+
static SetAmbientLight(sceneHandle: SceneHandle, r: number, g: number, b: number, intensity: number): boolean;
|
|
1019
|
+
/**
|
|
1020
|
+
* Set the fog parameters for the scene
|
|
1021
|
+
* @param sceneHandle The scene handle
|
|
1022
|
+
* @param enabled Whether fog is enabled
|
|
1023
|
+
* @param mode The fog mode
|
|
1024
|
+
* @param density The fog density
|
|
1025
|
+
* @param start The fog start distance
|
|
1026
|
+
* @param end The fog end distance
|
|
1027
|
+
* @returns boolean indicating success
|
|
1028
|
+
*/
|
|
1029
|
+
static SetFog(sceneHandle: SceneHandle, enabled: boolean, mode: number, density: number, start: number, end: number): boolean;
|
|
1030
|
+
}
|
|
1031
|
+
/**
|
|
1032
|
+
* Wrapper for Unity Transform RPCs.
|
|
1033
|
+
* Provides strongly-typed parameters and returns.
|
|
1034
|
+
*/
|
|
1035
|
+
export declare class TransformManager {
|
|
1036
|
+
/**
|
|
1037
|
+
* Checks if the entity has a Transform component.
|
|
1038
|
+
* @param entity The entity to check
|
|
1039
|
+
* @returns boolean indicating if transform component exists
|
|
1040
|
+
*/
|
|
1041
|
+
static HasComponent(entity: Entity): boolean;
|
|
1042
|
+
/**
|
|
1043
|
+
* Sets the world transform given a 16-element row-major matrix.
|
|
1044
|
+
* Transposes to column-major and flips Z-axis for Unity.
|
|
1045
|
+
* TODO: double check if this is correct, what are we using internally?
|
|
1046
|
+
* Use the coords provided by gl matrix or unity.
|
|
1047
|
+
* @param entity The entity with the transform component
|
|
1048
|
+
* @param srcMatrix The source transformation matrix
|
|
1049
|
+
* @returns boolean indicating success
|
|
1050
|
+
*/
|
|
1051
|
+
static SetTransform(entity: Entity, srcMatrix: mat4): boolean;
|
|
1052
|
+
/**
|
|
1053
|
+
* Retrieves the world transform matrix (column-major).
|
|
1054
|
+
* @param entity The entity with the transform component
|
|
1055
|
+
* @returns The transformation matrix
|
|
1056
|
+
*/
|
|
1057
|
+
static GetTransform(entity: Entity): mat4;
|
|
1058
|
+
/**
|
|
1059
|
+
* Sets this entity's parent transform.
|
|
1060
|
+
* @param entity The entity with the transform component
|
|
1061
|
+
* @param parent The parent entity
|
|
1062
|
+
* @returns boolean indicating success
|
|
1063
|
+
*/
|
|
1064
|
+
static SetParent(entity: Entity, parent: Entity): boolean;
|
|
1065
|
+
/**
|
|
1066
|
+
* Gets the parent entity handle, or -1 if none.
|
|
1067
|
+
* @param entity The entity with the transform component
|
|
1068
|
+
* @returns The parent entity handle
|
|
1069
|
+
*/
|
|
1070
|
+
static GetParent(entity: Entity): Entity;
|
|
1071
|
+
/**
|
|
1072
|
+
* Sets world position vector.
|
|
1073
|
+
* @param entity The entity with the transform component
|
|
1074
|
+
* @param pos The position vector
|
|
1075
|
+
* @returns boolean indicating success
|
|
1076
|
+
*/
|
|
1077
|
+
static SetWorldPosition(entity: Entity, pos: vec3): boolean;
|
|
1078
|
+
/**
|
|
1079
|
+
* Sets local position vector.
|
|
1080
|
+
* @param entity The entity with the transform component
|
|
1081
|
+
* @param pos The position vector
|
|
1082
|
+
* @returns boolean indicating success
|
|
1083
|
+
*/
|
|
1084
|
+
static SetLocalPosition(entity: Entity, pos: vec3): boolean;
|
|
1085
|
+
/**
|
|
1086
|
+
* Gets world position vector.
|
|
1087
|
+
* @param entity The entity with the transform component
|
|
1088
|
+
* @returns The position vector
|
|
1089
|
+
*/
|
|
1090
|
+
static GetWorldPosition(entity: Entity): vec3;
|
|
1091
|
+
/**
|
|
1092
|
+
* Gets local position vector.
|
|
1093
|
+
* @param entity The entity with the transform component
|
|
1094
|
+
* @returns The position vector
|
|
1095
|
+
*/
|
|
1096
|
+
static GetLocalPosition(entity: Entity): vec3;
|
|
1097
|
+
/**
|
|
1098
|
+
* Sets world rotation quaternion.
|
|
1099
|
+
* @param entity The entity with the transform component
|
|
1100
|
+
* @param quat The rotation quaternion [x, y, z, w]
|
|
1101
|
+
* @returns boolean indicating success
|
|
1102
|
+
*/
|
|
1103
|
+
static SetWorldRotation(entity: Entity, quat: quat): boolean;
|
|
1104
|
+
/**
|
|
1105
|
+
* Sets local rotation quaternion.
|
|
1106
|
+
* @param entity The entity with the transform component
|
|
1107
|
+
* @param quat The rotation quaternion [x, y, z, w]
|
|
1108
|
+
* @returns boolean indicating success
|
|
1109
|
+
*/
|
|
1110
|
+
static SetLocalRotation(entity: Entity, quat: quat): boolean;
|
|
1111
|
+
/**
|
|
1112
|
+
* Gets local rotation quaternion.
|
|
1113
|
+
* @param entity The entity with the transform component
|
|
1114
|
+
* @returns The rotation quaternion
|
|
1115
|
+
*/
|
|
1116
|
+
static GetWorldRotation(entity: Entity): quat;
|
|
1117
|
+
/**
|
|
1118
|
+
* Gets local rotation quaternion.
|
|
1119
|
+
* @param entity The entity with the transform component
|
|
1120
|
+
* @returns The rotation quaternion
|
|
1121
|
+
*/
|
|
1122
|
+
static GetLocalRotation(entity: Entity): quat;
|
|
1123
|
+
/**
|
|
1124
|
+
* Sets local scale vector.
|
|
1125
|
+
* @param entity The entity with the transform component
|
|
1126
|
+
* @param scale The scale vector
|
|
1127
|
+
* @returns boolean indicating success
|
|
1128
|
+
*/
|
|
1129
|
+
static SetLocalScale(entity: Entity, scale: vec3): boolean;
|
|
1130
|
+
/**
|
|
1131
|
+
* Gets local scale vector.
|
|
1132
|
+
* @param entity The entity with the transform component
|
|
1133
|
+
* @returns The position vector
|
|
1134
|
+
*/
|
|
1135
|
+
static GetLocalScale(entity: Entity): vec3;
|
|
1136
|
+
}
|
|
1137
|
+
export declare const base64Encode: (arraybuffer: ArrayBufferLike) => string;
|
|
1138
|
+
export declare const base64Decode: (base64: string) => ArrayBufferLike;
|
|
1139
|
+
|
|
1140
|
+
export {};
|