rea-analysis-optimization
MOmorluto/rea485k近 7 天新增 9,215 个 star
Adds or modifies <three-live> and <xr-live> plugins, userData.xr spatial traits, glTF ANDROID_xr_scenecore extensions, USDZ customData.xr metadata, and native Android (Filament / SceneCore) or iOS/visionOS (RealityKit) runtime features. Use when contributing new capabilities to the three-live monorepo or keeping Web, Rust, Android, and iOS/visionOS runtimes in parity.
<three-live> & <xr-live> PluginsEvery <xr-live> feature is authored once and executes across Web (WebGL2 / WebXR), Android (Filament / Jetpack XR SceneCore), and iOS & visionOS (RealityKit). Follow this 5-step workflow whenever adding or modifying a plugin or userData.xr trait so the platforms never drift.
three-live/src/xr-trait-schema.ts)three-live/src/xr-trait-schema.ts is the single source of truth for trait validation, clamping, and export serialization:
parse<Feature>(raw: unknown) using clampNum(v, lo, hi, fallback), isFiniteVec3(v), shortString(v, max), and safeMediaUrl(v).NormalizedXRTraits and normalizeXRTraits(raw) so both web plugins and exporters see identical defaults and bounds.buildXRSceneCoreExtension): Map the normalized field into nodes[i].extensions.ANDROID_xr_scenecore.flattenXRTraitsForUsd): Flatten nested objects into camelCase scalar/vec3 keys (<trait><Field>) so buildUsdXRLines() emits valid USDA customData = { dictionary xr = { ... } } lines without injection risk.xr-live/src/plugins/<name>.ts)ThreeLivePlugin (three-live/src/plugin.ts):
name: Unique 'xr-live-<name>' identifier.onElementConnected(element) / onElementDisconnected(element): Attach and clean up DOM event listeners (xr-select-start, xr-select-move, xr-select-end) via WeakMap state.onConfigureXRSessionInit(element, sessionInit): Add required/optional WebXR features (e.g. 'plane-detection', 'mesh-detection', 'hand-tracking').onXRFrame(viewer, session, frame, refSpace) & onUpdate(viewer, dt): Step per-frame simulation and dynamic meshes (createDynamicMesh, updateDynamicMesh, removeDynamicMesh, setWorldTRS from xr-live/src/plugins/common.ts).xr-live/src/plugins/index.ts.MAX_*) on any dynamic geometry, array, or network/event payload.mobile/android-runtime/)Update the Android runtime so compiled .glb scenes and scripts execute the trait identically:
mobile/android-runtime/src/main/java/com/google/threelive/XRLiveSceneCoreHelper.kt:
Parse the new extras.xr / ANDROID_xr_scenecore fields with the exact
same clamping ranges as xr-trait-schema.ts.mobile/android-runtime/src/main/java/com/google/threelive/<FeatureName>.kt)
& XRSpatialMath.kt: Implement pure, allocation-free math and per-feature
state machines in a dedicated Kotlin file (e.g. SpatialMeasure.kt,
MagneticSnap.kt, GazeDwell.kt, ExplodedView.kt,
PersistentAnchors.kt, SpatialLocomotion.kt, SharedRoom.kt) rather than
bloating a single monolith.mobile/android-runtime/src/main/java/com/google/threelive/XRSpatialFeatures.kt
& XRLiveRuntimeSession.kt: Wire the modular controller into
stepFrame(dtSeconds) and emit dynamic ThreeLiveMeshPrimitive geometry
(and optional sectionPlane uniforms) for ThreeLiveFilamentRenderer.kt.mobile/ios/)Update the Swift package under mobile/ios/Sources/ThreeLiveRuntime/:
XRLiveRuntimeSession.swift & XRLiveRealityKit.swift: Parse the trait from GLB extras.xr and USDZ customData.xr.<FeatureName>.swift),
XRSpatialRealityKitFeatures.swift, & XRLiveRealityKitSession.swift:
Mirror the math and dynamic entity updates in a dedicated Swift file (e.g.
SpatialMeasure.swift, MagneticSnap.swift, GazeDwell.swift,
ExplodedView.swift, PersistentAnchors.swift, SpatialLocomotion.swift,
SharedRoom.swift) orchestrated by XRSpatialRealityKitFeatures.swift.mobile/android-runtime/src/test/) and SwiftPM tests
(mobile/ios/Tests/).Rebuild Web bundles & embedded Rust engine asset:
node scripts/build.js
Verify that all 24 .min.js.gz bundles in scripts/build.js remain within
their enforced byte budgets:
three-live-viewer.min.js: < 38 KB gzthree-live.min.js: < 91 KB gzthree-live-studio.min.js: < 40 KB gzthree-live-cad.min.js: < 20 KB gzthree-live-kit-mechanical.min.js: < 18 KB gzthree-live-kit-architecture.min.js: < 18 KB gzthree-live-kit-industrial.min.js: < 14 KB gzthree-live-kit-science.min.js: < 31 KB gzthree-live-kit-electronics.min.js: < 14 KB gzthree-live-kits.min.js: < 85 KB gzthree-live-procedural.min.js: < 30 KB gzthree-live-animation.min.js: < 12 KB gzthree-live-ai.min.js: < 35 KB gzthree-live-webgpu.min.js: < 24 KB gzthree-live-tsl.min.js: < 19 KB gzthree-live-full.min.js: < 252 KB gzthree-live-compiler-bundle.min.js: < 268 KB gzxr-live-viewer.min.js: < 65 KB gzxr-live.min.js: < 103 KB gzxr-live-sensors.min.js: < 10 KB gzxr-live-spatial.min.js: < 68 KB gzxr-live-sim.min.js: < 30 KB gzxr-live-webgpu.min.js: < 13 KB gzxr-live-full.min.js: < 363 KB gzRun Web, Rust, and Mobile tests:
node scripts/build.js --test
cd compiler && cargo test
Update llms.txt and llms-full.txt:
node scripts/build_llms_txt.js
MOmorluto/rea485k近 7 天新增 9,215 个 star
MAmattpocock/skills336k近 7 天新增 5,004 个 star
MAmattpocock/skills336k近 7 天新增 5,004 个 star
MAmattpocock/skills336k近 7 天新增 5,004 个 star
MAmattpocock/skills336k近 7 天新增 5,004 个 star