lecodes-web-runtime 2.0.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.
@@ -0,0 +1,272 @@
1
+ [
2
+ "_addDecal",
3
+ "_addEntityToScene",
4
+ "_ambientCubeSet",
5
+ "_animatorBind",
6
+ "_animatorBoundTracks",
7
+ "_animatorCreate",
8
+ "_animatorDestroy",
9
+ "_animatorFootState",
10
+ "_animatorGetRootMotion",
11
+ "_animatorGetSlotTime",
12
+ "_animatorGetSlotWeight",
13
+ "_animatorIkAnchor",
14
+ "_animatorIkCreate",
15
+ "_animatorIkDestroy",
16
+ "_animatorIkNodes",
17
+ "_animatorIkSet",
18
+ "_animatorIkState",
19
+ "_animatorKneeAxis",
20
+ "_animatorLayerPhase",
21
+ "_animatorPlay",
22
+ "_animatorSeek",
23
+ "_animatorSeekPhase",
24
+ "_animatorSetBlend",
25
+ "_animatorSetBlendValue",
26
+ "_animatorSetDriveInput",
27
+ "_animatorSetFeet",
28
+ "_animatorSetFeetParams",
29
+ "_animatorSetGlobal",
30
+ "_animatorSetLayer",
31
+ "_animatorSetLayerAnticipation",
32
+ "_animatorSetMotion",
33
+ "_animatorSetRootMotion",
34
+ "_animatorSetSlotDrive",
35
+ "_animatorSetSocket",
36
+ "_animatorSetStepWarp",
37
+ "_animatorSetWarpParams",
38
+ "_animatorSlotAlign",
39
+ "_animatorSlotContacts",
40
+ "_animatorSlotCurveAt",
41
+ "_animatorSlotCurveInfo",
42
+ "_animatorSlotExit",
43
+ "_animatorSlotFeatures",
44
+ "_animatorSlotFit",
45
+ "_animatorSlotKneePole",
46
+ "_animatorSlotPhysics",
47
+ "_animatorSlotSetTurn",
48
+ "_animatorSlotSetWindow",
49
+ "_animatorSlotTimeAtTurn",
50
+ "_animatorSlotTreads",
51
+ "_animatorSlotTurn",
52
+ "_animatorStop",
53
+ "_characterCreate",
54
+ "_characterDestroy",
55
+ "_characterGetGroundState",
56
+ "_characterGetVelocity",
57
+ "_characterMove",
58
+ "_characterMoveFree",
59
+ "_characterSetGravityScale",
60
+ "_characterSetMaxSlope",
61
+ "_characterSetPosition",
62
+ "_characterSetShape",
63
+ "_characterSetVelocity",
64
+ "_characterSetVerticalVelocity",
65
+ "_clearDecals",
66
+ "_cloneEntity",
67
+ "_computeBoundingBox",
68
+ "_createClipFromTracks",
69
+ "_createDecalSet",
70
+ "_createEntity",
71
+ "_createInstancedMesh",
72
+ "_createMaterialInstanceFromBytes",
73
+ "_createMeshC",
74
+ "_createNoise",
75
+ "_createOverlayScene",
76
+ "_createParticleSystem",
77
+ "_createPointLight",
78
+ "_createScene",
79
+ "_createSunLight",
80
+ "_createTexturePixels",
81
+ "_creatorHasLightmapBake",
82
+ "_creatorHasPhysics",
83
+ "_decalCount",
84
+ "_deriveClip",
85
+ "_destroyClipSet",
86
+ "_dynamicBoneColliderCreate",
87
+ "_dynamicBoneColliderDestroy",
88
+ "_dynamicBoneColliderSet",
89
+ "_dynamicBoneCreate",
90
+ "_dynamicBoneDestroy",
91
+ "_dynamicBoneParticles",
92
+ "_dynamicBoneReset",
93
+ "_dynamicBoneSet",
94
+ "_dynamicBoneSetColliders",
95
+ "_dynamicBoneSetFloor",
96
+ "_dynamicBoneTargets",
97
+ "_entityIsOwned",
98
+ "_findNode",
99
+ "_foliageSetBender",
100
+ "_foliageSetFade",
101
+ "_foliageSetLeaf",
102
+ "_foliageSetLook",
103
+ "_foliageSetOptions",
104
+ "_foliageSetWind",
105
+ "_getCameraFov",
106
+ "_getCameraViewDirection",
107
+ "_getChild",
108
+ "_getChildCount",
109
+ "_getClipInfos",
110
+ "_getDisplayHeadroom",
111
+ "_getGlbClipSet",
112
+ "_getHdrPaperWhite",
113
+ "_getHdrStrength",
114
+ "_getMaterial",
115
+ "_getMatrix",
116
+ "_getName",
117
+ "_getNoise2D",
118
+ "_getNoise3D",
119
+ "_getParent",
120
+ "_getWorldDirection",
121
+ "_getWorldMatrix",
122
+ "_getWorldMatrixInverse",
123
+ "_getWorldPosition",
124
+ "_hasMesh",
125
+ "_isVisible",
126
+ "_lightVolumeClear",
127
+ "_lightVolumeLoad",
128
+ "_lightVolumeSample",
129
+ "_lightVolumeTrack",
130
+ "_lightmapApply",
131
+ "_lightmapDebug",
132
+ "_lightmapObjectApply",
133
+ "_lightmapProbesSet",
134
+ "_lightmapSetOptions",
135
+ "_lightmapSunSet",
136
+ "_locoBuildDatabase",
137
+ "_locoClearSet",
138
+ "_locoCreate",
139
+ "_locoDefaults",
140
+ "_locoDestroy",
141
+ "_locoRead",
142
+ "_locoSetEntry",
143
+ "_locoSetInput",
144
+ "_locoSetParams",
145
+ "_locoStep",
146
+ "_locoStopReport",
147
+ "_locoUpdate",
148
+ "_physicsApplyImpulse",
149
+ "_physicsApplyImpulseAt",
150
+ "_physicsBuildBox",
151
+ "_physicsBuildCapsule",
152
+ "_physicsBuildCylinder",
153
+ "_physicsBuildHeightField",
154
+ "_physicsBuildMesh",
155
+ "_physicsBuildMeshFromEntity",
156
+ "_physicsBuildSphere",
157
+ "_physicsConfigure",
158
+ "_physicsCreateBody",
159
+ "_physicsCreateBox",
160
+ "_physicsCreateCylinder",
161
+ "_physicsCreateSphere",
162
+ "_physicsDestroyShape",
163
+ "_physicsGetAngularVelocity",
164
+ "_physicsGetFriction",
165
+ "_physicsGetLinearVelocity",
166
+ "_physicsRaycast",
167
+ "_physicsRemoveBody",
168
+ "_physicsSetAngularVelocity",
169
+ "_physicsSetBodyPosition",
170
+ "_physicsSetBodyRotation",
171
+ "_physicsSetBodyShape",
172
+ "_physicsSetFriction",
173
+ "_physicsSetLinearVelocity",
174
+ "_physicsSetPickable",
175
+ "_physicsSetShapeOrigin",
176
+ "_physicsStaticGeometry",
177
+ "_physicsUpdateHeightField",
178
+ "_pickTriangle",
179
+ "_ragdollActivate",
180
+ "_ragdollActive",
181
+ "_ragdollBodyId",
182
+ "_ragdollCreate",
183
+ "_ragdollDeactivate",
184
+ "_ragdollDestroy",
185
+ "_ragdollSetDrive",
186
+ "_removeDecal",
187
+ "_removeEntityFromScene",
188
+ "_setAmbientOcclusionOptions",
189
+ "_setBloomOptions",
190
+ "_setCameraExposure",
191
+ "_setCameraProjection",
192
+ "_setCastShadows",
193
+ "_setClipAnchors",
194
+ "_setClipEvents",
195
+ "_setColliderBox",
196
+ "_setColliderFromMesh",
197
+ "_setColliderSphere",
198
+ "_setCulling",
199
+ "_setDepthEffects",
200
+ "_setEnvironmentIntensity",
201
+ "_setEulerAngles",
202
+ "_setFogOptions",
203
+ "_setGlbCulling",
204
+ "_setGlbShadows",
205
+ "_setHdrPaperWhite",
206
+ "_setHdrStrength",
207
+ "_setInstanceTransforms",
208
+ "_setInstancedMeshMaterial",
209
+ "_setInstancedMeshShadows",
210
+ "_setLightBakeArea",
211
+ "_setLightChannel",
212
+ "_setLightColor",
213
+ "_setLightIntensity",
214
+ "_setLod",
215
+ "_setLodBias",
216
+ "_setMaterial",
217
+ "_setMaterialCulling",
218
+ "_setMaterialDepthTest",
219
+ "_setMaterialDepthWrite",
220
+ "_setMaterialGlobalParameter",
221
+ "_setMaterialStencil",
222
+ "_setMatrix",
223
+ "_setMultiSampleAntiAliasing",
224
+ "_setName",
225
+ "_setNoiseFractalGain",
226
+ "_setNoiseFractalLunacrity",
227
+ "_setNoiseFrequency",
228
+ "_setNoiseOctaves",
229
+ "_setParent",
230
+ "_setParentNull",
231
+ "_setParticleSystemConfig",
232
+ "_setPhysicsInterpolation",
233
+ "_setPosition",
234
+ "_setQuaternion",
235
+ "_setReceiveShadows",
236
+ "_setRenderPriority",
237
+ "_setScale",
238
+ "_setSceneRenderOptions",
239
+ "_setSceneStencil",
240
+ "_setSkybox",
241
+ "_setSkyboxFromEnvironment",
242
+ "_setSkyboxTexture",
243
+ "_setTemporalAntiAliasing",
244
+ "_setTextureAnisotropy",
245
+ "_setTextureMaxSize",
246
+ "_setTimeScale",
247
+ "_setToneMapping",
248
+ "_setUniformArray",
249
+ "_setUniformBoolean",
250
+ "_setUniformFloat",
251
+ "_setUniformNull",
252
+ "_setUniformRgb",
253
+ "_setUniformRgba",
254
+ "_setUniformTexture",
255
+ "_setVisible",
256
+ "_setWorldMatrix",
257
+ "_skinnedCullingSupported",
258
+ "_spawnParticles",
259
+ "_terrainCreate",
260
+ "_terrainSetMaterial",
261
+ "_terrainSetShadows",
262
+ "_terrainUpdate",
263
+ "_updateDecal",
264
+ "_updateTexturePixels",
265
+ "_vehicleBodyId",
266
+ "_vehicleCreate",
267
+ "_vehicleDestroy",
268
+ "_vehicleGetState",
269
+ "_vehicleReset",
270
+ "_vehicleSetInput",
271
+ "_vehicleSetTuning"
272
+ ]
@@ -0,0 +1,24 @@
1
+ [
2
+ "_cnavAgentAdd",
3
+ "_cnavAgentRemove",
4
+ "_cnavAgentResetTarget",
5
+ "_cnavAgentSetParams",
6
+ "_cnavAgentSetTarget",
7
+ "_cnavAgentSetVelocity",
8
+ "_cnavAgentWarp",
9
+ "_cnavCrowdFree",
10
+ "_cnavCrowdNew",
11
+ "_cnavCrowdReadAll",
12
+ "_cnavCrowdStep",
13
+ "_cnavHeader",
14
+ "_cnavLastError",
15
+ "_cnavLoad",
16
+ "_cnavNearestPoint",
17
+ "_cnavPath",
18
+ "_cnavPolyCount",
19
+ "_cnavRandom",
20
+ "_cnavRay",
21
+ "_cnavSetAreaCost",
22
+ "_cnavTriangles",
23
+ "_cnavUnload"
24
+ ]
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "lecodes-web-runtime",
3
+ "version": "2.0.0",
4
+ "main": "src/profile.ts",
5
+ "description": "The web runtime of LeCodes: the engines as wasm profiles (native/dist) + the generated bridges over them",
6
+ "dependencies": {
7
+ "lecodes-sdk": "2.0.0"
8
+ },
9
+ "devDependencies": {
10
+ "lecodes-gl-lite": "2.0.0",
11
+ "pngjs": "^7.0.0",
12
+ "typescript": "~5.8.3",
13
+ "vite": "^6.3.5"
14
+ },
15
+ "scripts": {
16
+ "test": "bun test",
17
+ "typecheck": "tsc --noEmit -p tsconfig.json"
18
+ },
19
+ "type": "module",
20
+ "files": [
21
+ "src",
22
+ "!src/assets/neutral_ibl256.ktx",
23
+ "native/dist",
24
+ "native/exports",
25
+ "native/gen"
26
+ ],
27
+ "publishConfig": {
28
+ "access": "public"
29
+ }
30
+ }
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,199 @@
1
+ // GENERATED by scripts/gen-bridges.ts from the host tables of sdk/src/bridges/*.d.ts — do not edit.
2
+ // The host contract as a wasm host implements it in TypeScript (scripts/lib/gen-host-wasm.ts):
3
+ // one interface per table of creator-pkg/host.gen.h, optional slots optional. Callbacks are
4
+ // plain functions (calling one posts through the runtime's dispatch queue); typed-array
5
+ // parameters are views of the module heap valid for the call; byte results are copied out.
6
+
7
+ /** The host's gl table (export interface HostGL of sdk/src/bridges/gl.d.ts) — optional as a whole. */
8
+ export interface WasmHostGL {
9
+ getGLContext?(): number
10
+ engineCreated?(): void
11
+ createGLView?(): void
12
+ closeScene?(): void
13
+ createTexture(systemId: number, flags: number, onComplete: (textureId: number, width: number, height: number) => void, onReject: (err: string) => void): void
14
+ createMediaPlayerTexture?(playerId: number): number
15
+ launchAR?(sceneId: number, onComplete: () => void, onReject: (err: string) => void): void
16
+ stopAR?(): void
17
+ launchVR?(sceneId: number, onComplete: () => void, onReject: (err: string) => void): void
18
+ stopVR?(): void
19
+ createARController?(sceneId: number, cameraId: number, mode: string): void
20
+ createRootAnchor?(sceneId: number, entityId: number): void
21
+ createAnchor?(sceneId: number, entityId: number, physicalWidth: number, systemId: number): void
22
+ }
23
+
24
+ /** The host's scene2d table (export interface HostScene2d of sdk/src/bridges/2d.d.ts) — optional as a whole. */
25
+ export interface WasmHostScene2d {
26
+ open2DScene?(sceneId: number): void
27
+ close2DScene?(): void
28
+ init2D?(): void
29
+ }
30
+
31
+ /** The host's ui table (export interface HostUI of sdk/src/bridges/tree.d.ts). */
32
+ export interface WasmHostUI {
33
+ nodeFactory(id: number, type: string, parent: number, index: number): void
34
+ setPropertyString(id: number, prop: string, value: string | null): void
35
+ setPropertyInt(id: number, prop: string, value: number): void
36
+ setFlags(id: number, mask: number): void
37
+ insertNode(parent: number, child: number, index: number): void
38
+ removeNode(parent: number, child: number): void
39
+ releaseNode(id: number): void
40
+ openView(kind: number, node: number, id: number, viewName: string, paramsJson: string, above: boolean): void
41
+ dropView(kind: number, node: number, id: number): void
42
+ closeView(): void
43
+ isViewSupported?(name: string): boolean
44
+ viewVersion?(name: string): number
45
+ viewCall?(viewId: number, method: string, args: unknown, onComplete: (result?: unknown) => void, onReject: (message: string) => void): void
46
+ widgetOpen(node: number, ownerKind: number, ownerId: number, ownerNode: number): void
47
+ widgetClose(node: number): void
48
+ registerFont(url: string, fontFamily: string, weight: number, style: number, onComplete: () => void, onReject: (err: string) => void): void
49
+ showToast(message: string, duration: number): void
50
+ getButtonPressed(node: number): boolean
51
+ getTextValue(node: number): string
52
+ getBoundingRect?(node: number): ArrayLike<number> | null
53
+ touchHandler?(pointerId: number, hasMove: boolean, claim: number, node: number): void
54
+ longPressHandler?(pointerId: number, node: number): void
55
+ vlistScroll(node: number, scrollY: number, animated: boolean): void
56
+ pagerCommand?(node: number, cmd: string, animated: boolean): void
57
+ pagerShowPage?(node: number, page: number, above: boolean): void
58
+ pagerDropPage?(node: number, page: number): void
59
+ pagerPageMounted?(page: number, mounted: boolean): void
60
+ tweenClaim?(node: number, prop: string, lanes: number, samples: Float32Array, durationMs: number, delayMs: number, iterations: number, pingPong: boolean, rate: number): boolean
61
+ tweenRelease?(node: number, prop: string, reason: number): void
62
+ }
63
+
64
+ /** The host's canvas table (export interface HostCanvas of sdk/src/bridges/canvas.d.ts) — optional as a whole. */
65
+ export interface WasmHostCanvas {
66
+ paint(surfaceId: number, pw: number, ph: number, scale: number, words: Float32Array, strings: string[]): void
67
+ measureText(text: string, family: string, size: number, weight: number, italic: boolean, out: Float32Array): void
68
+ decodeImage(bufferId: number, surfaceId: number, size: Int32Array): boolean
69
+ readPixels(surfaceId: number, size: Int32Array): Uint8Array | null
70
+ releaseSurface(surfaceId: number): void
71
+ }
72
+
73
+ /** The host's side of _creatorApp (sdk/src/bridges/app.d.ts). */
74
+ export interface WasmHostApp {
75
+ state?(): string
76
+ isOnline?(): boolean
77
+ openUrl?(url: string): void
78
+ setOrientation?(mode: string): void
79
+ worldChange?(projectUuid: string | null, trusted: boolean): void
80
+ exit?(): void
81
+ }
82
+
83
+ /** The host's side of _creatorDevice (sdk/src/bridges/device.d.ts). */
84
+ export interface WasmHostDevice {
85
+ readonly platform: string
86
+ readonly language: string
87
+ readonly pixelRatio: number
88
+ setPreciseTouch?(enabled: boolean): void
89
+ vibrate?(style: string): void
90
+ motionAvailable?(): boolean
91
+ motionStart?(interval: number): boolean
92
+ motionStop?(): void
93
+ motionSample?(): ArrayLike<number> | null
94
+ clipboardWrite?(text: string): void
95
+ clipboardRead?(onComplete: (text: string) => void, onReject: (err: string) => void): void
96
+ share?(systemId: number, text?: string | null): void
97
+ openFilePicker?(onComplete: (files: [id: number, name: string, size: number][] | null) => void, onReject: (err: Error) => void, multiple: boolean, accept?: string | null): void
98
+ requestCamera?(onComplete: () => void, onReject: () => void): void
99
+ }
100
+
101
+ /** The host's side of _creatorFetch (sdk/src/bridges/fetch.d.ts). */
102
+ export interface WasmHostFetch {
103
+ local(path: string): number
104
+ dispose?(systemId: number): void
105
+ request(url: string, method: string, headers: string[], body: string | null, form: FetchFormEntry[], onComplete: (systemId: number, status: number) => void, onReject: (err: string) => void, onProgress?: (progress: { loaded: number, total?: number }) => void): void
106
+ buffer(id: number, addByte: boolean): Uint8Array | null
107
+ bufferSlice(id: number, start: number, end: number, addByte: boolean): Uint8Array | null
108
+ systemBuffer(id: number): Uint8Array | null
109
+ putBuffer?(bytes: Uint8Array): number
110
+ }
111
+
112
+ /** `export type FetchFormEntry` of sdk/src/bridges/fetch.d.ts. */
113
+ export interface FetchFormEntry {
114
+ key: string | null
115
+ value: string | null
116
+ bufferId: number
117
+ filename: string | null
118
+ }
119
+
120
+ /** The host's side of _creatorFiles (sdk/src/bridges/files.d.ts) — optional as a whole. */
121
+ export interface WasmHostFiles {
122
+ readBytes(path: string, onComplete: (bytes: Uint8Array | null) => void, onReject: (err: Error) => void): void
123
+ readText(path: string, onComplete: (text: string | null) => void, onReject: (err: Error) => void): void
124
+ remove(path: string, recursive: boolean, onComplete: () => void, onReject: (err: Error) => void): void
125
+ mkdir(path: string, onComplete: () => void, onReject: (err: Error) => void): void
126
+ list(path: string, recursive: boolean, onComplete: (entries: FileEntry[] | null) => void, onReject: (err: Error) => void): void
127
+ stat(path: string, onComplete: (entry: FileEntry | null) => void, onReject: (err: Error) => void): void
128
+ write(path: string, data: Uint8Array, append: boolean, onComplete: () => void, onReject: (err: Error) => void): void
129
+ }
130
+
131
+ /** `export type FileEntry` of sdk/src/bridges/files.d.ts. */
132
+ export interface FileEntry {
133
+ name: string | null
134
+ path: string | null
135
+ kind: "file" | "dir"
136
+ size: number
137
+ modified: number
138
+ }
139
+
140
+ /** The host's side of _creatorStorage (sdk/src/bridges/storage.d.ts). */
141
+ export interface WasmHostStorage {
142
+ load?(name: string): string | null
143
+ save?(name: string, json: string): void
144
+ }
145
+
146
+ /** The host's side of _creatorSocket (sdk/src/bridges/socket.d.ts). */
147
+ export interface WasmHostSocket {
148
+ send(id: number, message: string): void
149
+ open(url: string, onMessage: (channel: string, data?: any) => void): number
150
+ close(id: number): void
151
+ }
152
+
153
+ /** The host's side of _creatorService (sdk/src/bridges/service.d.ts) — optional as a whole. */
154
+ export interface WasmHostService {
155
+ supported(name: string): boolean
156
+ open(name: string, params: string, onEvent: (event: string, data?: unknown) => void): number
157
+ close(serviceId: number): void
158
+ version?(name: string): number
159
+ call(serviceId: number, method: string, args: unknown, onComplete: (result?: unknown) => void, onError: (err: string) => void): void
160
+ }
161
+
162
+ /** The host's side of _creatorInput (sdk/src/bridges/input.d.ts). */
163
+ export interface WasmHostInput {
164
+ key?(code: string, gamepad: number): boolean
165
+ read?(channel: number): number
166
+ setPointerLock?(on: boolean): boolean
167
+ rumble?(gamepad: number, strong: number, weak: number, durationMs: number): boolean
168
+ keyboardHeight?(): number
169
+ }
170
+
171
+ /** The host's side of _creatorMedia (sdk/src/bridges/media.d.ts) — optional as a whole. */
172
+ export interface WasmHostMedia {
173
+ setVolume(id: number, volume: number): void
174
+ time?(id: number): number
175
+ setTime?(id: number, time: number): void
176
+ duration?(id: number): number
177
+ createAudio(src: string, onFinished: () => void): number
178
+ createVideo(src: string, onFinished: () => void): number
179
+ setLoop(id: number, loop: boolean): void
180
+ setPlaying(id: number, playing: boolean): void
181
+ remove?(id: number): void
182
+ }
183
+
184
+ /** Every table of the contract, as the glue's `host` object (absent = the host has none). */
185
+ export type WasmHostTables = {
186
+ gl?: WasmHostGL
187
+ scene2d?: WasmHostScene2d
188
+ ui: WasmHostUI
189
+ canvas?: WasmHostCanvas
190
+ app: WasmHostApp
191
+ device: WasmHostDevice
192
+ fetch: WasmHostFetch
193
+ files?: WasmHostFiles
194
+ storage: WasmHostStorage
195
+ socket: WasmHostSocket
196
+ service?: WasmHostService
197
+ input: WasmHostInput
198
+ media?: WasmHostMedia
199
+ }
@@ -0,0 +1,12 @@
1
+ // GENERATED by engines/gl/materials/build.mjs from materials.json `groups` — do not edit.
2
+ // The archive a built-in material rides: a name that is not here rides the base one.
3
+ export const MATERIAL_GROUP: Record<string, string> = {
4
+ "lightmap": "world",
5
+ "lightmap-masked": "world",
6
+ "lightmap-lite": "world",
7
+ "lightmap-masked-lite": "world",
8
+ "terrain": "world",
9
+ "terrain-lightmap": "world",
10
+ "foliage": "world",
11
+ "foliage-masked": "world",
12
+ }