lecodes-sdk 2.3.0 → 2.4.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/dist/global.d.ts +4 -0
- package/dist/types/gl/Foliage.d.ts +5 -0
- package/dist/types/gl/Lightmap.d.ts +5 -3
- package/dist/types/gl/Material.d.ts +6 -0
- package/dist/types/gl/Scatter.d.ts +25 -0
- package/dist/types/gl/terrain/Terrain.d.ts +5 -0
- package/dist/types/inject.d.ts +2 -0
- package/dist/types/runtime/device.d.ts +20 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/types.json +1 -1
- package/package.json +1 -1
- package/src/animate/tween/Timeline.ts +175 -175
- package/src/audio/support.ts +3 -1
- package/src/bridges/audio.d.ts +23 -18
- package/src/bridges/device.d.ts +19 -0
- package/src/bridges/gl.d.ts +11 -0
- package/src/compile/serverSplit.ts +8 -1
- package/src/gl/CameraPlace.ts +52 -52
- package/src/gl/Foliage.ts +7 -0
- package/src/gl/Light.ts +257 -257
- package/src/gl/Lightmap.ts +8 -3
- package/src/gl/Material.ts +10 -1
- package/src/gl/Mesh.ts +120 -120
- package/src/gl/Scatter.ts +67 -0
- package/src/gl/animation/DynamicBone.ts +486 -486
- package/src/gl/scenarios.ts +291 -291
- package/src/gl/terrain/Terrain.ts +17 -0
- package/src/inject.ts +2 -0
- package/src/runtime/device.ts +29 -0
- package/src/version.ts +1 -1
package/src/runtime/device.ts
CHANGED
|
@@ -142,6 +142,35 @@ export const device = {
|
|
|
142
142
|
set statsOverlay(on: boolean) {
|
|
143
143
|
_creatorDevice.setStatsOverlay?.(!!on)
|
|
144
144
|
},
|
|
145
|
+
/** Cap the frame rate: the host runs the frame — the tick, the 3D scene — at most `fps` times a
|
|
146
|
+
* second. `0` removes the cap: the display's own rate (120 on a 120 Hz phone), or, with vsync
|
|
147
|
+
* off, as fast as the host renders. A REQUEST, not a state the app owns: a phone asks its panel
|
|
148
|
+
* for the rate (a 120 Hz panel at 60 shows every frame for a full period — even, cooler) and an
|
|
149
|
+
* OEM may refuse the switch, in which case the host renders every second refresh instead; the
|
|
150
|
+
* screen's own maximum always wins. The tick IS the frame here, so a cap of 30 is 30 Hz of game
|
|
151
|
+
* logic and input sampling too — raise it for gameplay. Host state: it stays through a project
|
|
152
|
+
* swap. A no-op on hosts whose loop has no pacing of its own (web, headless). */
|
|
153
|
+
setFrameRate(fps: number): void {
|
|
154
|
+
const n = +fps
|
|
155
|
+
_creatorDevice.setFrameRate?.(n > 0 && Number.isFinite(n) ? n : 0)
|
|
156
|
+
},
|
|
157
|
+
/** Vertical sync: `false` presents without waiting for the display's refresh — the lowest input
|
|
158
|
+
* latency, tearing possible, and with no cap set (`setFrameRate(0)`) the loop renders as fast as
|
|
159
|
+
* it can. Set a cap unless you are measuring. Desktop only: a mobile compositor never presents
|
|
160
|
+
* outside the refresh. Returns whether the host took the request (`false` on a host without
|
|
161
|
+
* the switch), so a settings menu can hide the toggle. */
|
|
162
|
+
setVsync(enabled: boolean): boolean {
|
|
163
|
+
if (!_creatorDevice.setVsync) return false
|
|
164
|
+
_creatorDevice.setVsync(!!enabled)
|
|
165
|
+
return true
|
|
166
|
+
},
|
|
167
|
+
/** The display's refresh rate in Hz: the fastest the screen offers the app — 120 on a 120 Hz
|
|
168
|
+
* phone whatever mode a cap has put it in (an iPhone's 60 unless the app's Info.plist lifts the
|
|
169
|
+
* floor), the monitor's current mode on desktop. The sensible choices of a frame-rate menu are
|
|
170
|
+
* its divisors. 0 where the host cannot tell (web). */
|
|
171
|
+
get displayRefreshRate(): number {
|
|
172
|
+
return _creatorDevice.displayRefreshRate?.() ?? 0
|
|
173
|
+
},
|
|
145
174
|
/** Device-orientation sensor (gyro + accelerometer, fused) for tilt/steering and magic-window /
|
|
146
175
|
* 360° panoramas. Poll `attitude` / `gravity` inside setLoop; they return the freshest fused
|
|
147
176
|
* sample, so the sensor rate need not match your frame rate. Host-gated: a no-op with no sensor. */
|
package/src/version.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// same manifest). Its MAJOR is the bundle ↔ runtime contract: a bundle's `// sdk:` header line
|
|
5
5
|
// and a host's embedded version must agree on the major for the host to run the bundle; minor
|
|
6
6
|
// and patch never gate anything (features are detected, never versioned).
|
|
7
|
-
export const SDK_VERSION = "2.
|
|
7
|
+
export const SDK_VERSION = "2.4.0"
|
|
8
8
|
|
|
9
9
|
/** The major of a semver string, or null when it is not one. */
|
|
10
10
|
export const sdkMajor = (version: string | null | undefined): number | null => {
|