Skip to content

Update PhysX WASM binaries and CDN URLs#2909

Merged
cptbtptpbcptdtptp merged 1 commit intodev/2.0from
update-physx-wasm
Mar 1, 2026
Merged

Update PhysX WASM binaries and CDN URLs#2909
cptbtptpbcptdtptp merged 1 commit intodev/2.0from
update-physx-wasm

Conversation

@GuoLei1990
Copy link
Member

@GuoLei1990 GuoLei1990 commented Feb 28, 2026

with:galacean/physX.js#17

Summary

  • Update PhysX WASM binaries (both normal and SIMD versions)
  • Update CDN default URLs in PhysXPhysics.ts
  • WASM size reduced slightly (~5.5KB for normal, ~7.2KB for SIMD)

Test plan

  • Verify PhysX physics initialization with default CDN URLs
  • Test both WASM and SIMD WASM modes
  • Run physics-related e2e tests

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added mesh collider shapes for advanced physics interactions.
    • Introduced WebAssembly SIMD support for PhysX runtime.
    • Added ColorWriteMask shader support for render state control.
    • New asset wrapper types (TextAsset, JSONAsset, BufferAsset) for resource management.
  • Improvements

    • Trail renderer width now uses curve-based control.
    • Enhanced animation cross-fade interrupt handling.
    • Optimized text rendering with alpha-channel texture format.
  • Deprecations

    • UICanvas.renderCamera → use camera instead.
  • Chores

    • Version bumped to 2.0.0-alpha.2.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Feb 28, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 28, 2026

Caution

Review failed

Failed to post review comments

Walkthrough

This pull request introduces PhysX SIMD WebAssembly runtime support, mesh collider shapes for physics, comprehensive asset wrapper classes (TextAsset, JSONAsset, BufferAsset), refactored Trail Renderer with curve-based widths, improved animation cross-fade interruption logic, deferred object destruction mechanics, UI camera API rename with deprecation, ColorWriteMask shader support, and corresponding E2E tests. Version bumped to 2.0.0-alpha.2 across all packages.

Changes

Cohort / File(s) Summary
PhysX SIMD Runtime
e2e/.dev/physx.release.simd.js, packages/physics-physx/libs/physx.release.simd.js
Added new WebAssembly SIMD binary loader with Emscripten/Embind runtime integration, environment detection (Web/Worker/Node), and CommonJS/AMD module exports.
Mesh Collider Shape Implementation
packages/core/src/physics/shape/MeshColliderShape.ts, packages/physics-physx/src/shape/PhysXMeshColliderShape.ts, packages/design/src/physics/shape/IMeshColliderShape.ts
Introduced new mesh collider shape classes with convex hull and triangle mesh support, cooking flags, mesh data extraction, and native shape lifecycle management.
Physics API Interfaces
packages/design/src/physics/IPhysics.ts, packages/physics-lite/src/LitePhysics.ts, packages/physics-physx/src/PhysXPhysics.ts
Added createMeshColliderShape method to physics interfaces; updated PhysXRuntimeUrls to include wasmSIMDModeUrl and remove javaScriptModeUrl; added cooking initialization.
Physics Runtime Mode
packages/physics-physx/src/enum/PhysXRuntimeMode.ts, e2e/case/physx-*.ts
Replaced JavaScript runtime option with WebAssemblySIMD; updated Auto mode to detect SIMD support via SystemInfo; refactored physics test cases to use wasmSIMDModeUrl.
Asset Wrapper Classes
packages/core/src/asset/TextAsset.ts, packages/core/src/asset/JSONAsset.ts, packages/core/src/asset/BufferAsset.ts, packages/core/src/index.ts
Introduced TextAsset, JSONAsset, BufferAsset extending EngineObject with public data/text/buffer properties and _onDestroy lifecycle cleanup.
Loader Updates
packages/loader/src/TextLoader.ts, packages/loader/src/JSONLoader.ts, packages/loader/src/BufferLoader.ts
Refactored loaders to return wrapped asset instances (TextAsset/JSONAsset/BufferAsset) instead of raw types; updated decorators and return signatures.
Object Lifecycle Management
packages/core/src/base/EngineObject.ts, packages/core/src/Engine.ts, packages/core/src/ComponentsManager.ts
Implemented deferred destruction via _pendingDestroyObjects; added _frameInProcess flag; introduced _processPendingDestroyObjects(); removed handlingInvalidScripts destruction path.
Trail Renderer Refactoring
packages/core/src/trail/TrailRenderer.ts, e2e/case/trailRenderer-basic.ts, tests/src/core/Trail.test.ts
Changed from scalar width to widthCurve with Vector2 textureScale; updated texture mode and scale mappings in _trailParams; added _onTextureScaleChanged lifecycle.
Animation Cross-Fade Interrupts
packages/core/src/animation/Animator.ts, packages/core/src/animation/AnimatorController.ts, packages/core/src/animation/AnimatorControllerLayer.ts, packages/core/src/animation/AnimatorState.ts, packages/core/src/animation/AnimatorStateMachine.ts
Added _tryCrossFadeInterrupt logic and _checkNoExitTimeTransitions with excludeDestState; introduced _setEngine propagation through controller/layer/state hierarchy; replaced internal script callbacks with direct state method calls.
StateMachineScript Refactoring
packages/core/src/animation/StateMachineScript.ts
Changed from standalone class to EngineObject extension; removed _destroyed flag; replaced destroy() with protected _onDestroy() override.
Text/Font Rendering
packages/core/src/2d/atlas/FontAtlas.ts, packages/core/src/2d/text/SubFont.ts, packages/core/src/2d/text/TextUtils.ts
Added texture format selection (R8 vs Alpha8) based on WebGL2; disabled mipmap generation; switched glyph data from RGBA to alpha-only format.
Physics Collider Enhancements
packages/core/src/physics/Collider.ts, packages/core/src/physics/DynamicCollider.ts, packages/core/src/physics/shape/ColliderShape.ts
Added null-safe guards for _nativeShape; prevented non-convex mesh colliders on non-kinematic bodies; added collision detection mode sync; introduced addShape override in DynamicCollider.
CCD Flags Configuration
packages/physics-physx/src/PhysXDynamicCollider.ts
Updated collision detection mode flag combinations: explicit CCD/CCD_FRICTION/Speculative CCD settings per mode; refined Continuous, ContinuousDynamic, ContinuousSpeculative, and Discrete configurations.
UI Camera API
packages/ui/src/component/UICanvas.ts, packages/ui/src/input/UIPointerEventEmitter.ts, tests/src/ui/UICanvas.test.ts
Renamed renderCamera to camera with deprecated alias; updated all internal references; changed pointer event dispatch check from _canRender to _canDispatchEvent; added WorldSpace cloning tests.
Shader Lab Enhancements
packages/shader-lab/src/common/enums/Keyword.ts, packages/shader-lab/src/sourceParser/ShaderSourceParser.ts, packages/shader-lab/src/sourceParser/SourceLexer.ts
Added BitwiseOr and GSColorWriteMask keywords; extended parser to support ColorWriteMask enum with bitwise OR chaining; added enum validation for operator mixing.
PBR Shader Pass
packages/shader/src/shaders/PBR.gs
Added UsePass for DepthOnly in Default subshader.
Build Configuration
rollup.config.js, package.json
Added bundled build path (config.bundled) with compression support; new BUILD_TYPE="BUNDLED" case; extended getAll() to include bundled configs; added b:bundled npm script.
E2E Test Suite
e2e/case/camera-ssao.ts, e2e/case/material-white-furnace.ts, e2e/case/physx-mesh-collider.ts, e2e/case/physx-mesh-collider-data.ts, e2e/config.ts
Added white-furnace material test; mesh collider test scenarios with convex/triangle meshes; collision scripts with state feedback; updated diffPercentages and thresholds.
Unit Test Coverage
tests/src/core/Animator.test.ts, tests/src/core/Entity.test.ts, tests/src/core/Script.test.ts, tests/src/core/physics/MeshColliderShape.test.ts, tests/src/loader/RawAssetLoader.test.ts, tests/src/shader-lab/ShaderLab.test.ts
Added comprehensive test cases for animation interrupts, entity root handling, script destruction, mesh collider shapes, asset loaders, and shader ColorWriteMask support.
Version Bumps
package.json, e2e/package.json, examples/package.json, packages/*/package.json
Updated all package versions from 1.6.13 to 2.0.0-alpha.2; added unpkg/jsdelivr entries in galacean package.
Resource Manager Generics
packages/core/src/asset/ResourceManager.ts
Constrained load/getResourceByRef generic parameters to T extends EngineObject for type safety.
Miscellaneous Improvements
packages/core/src/Entity.ts, packages/core/src/Scene.ts, packages/core/src/Script.ts, packages/core/src/mesh/SkinnedMeshRenderer.ts, packages/core/src/audio/AudioManager.ts, packages/ui/src/component/advanced/Image.ts, packages/loader/src/ShaderChunkLoader.ts
Added Entity._tempComponentConstructors reuse; removed Scene.handlingInvalidScripts call; simplified Script._onDestroy; exposed AudioManager.suspend(); added @ts-ignore directives; refactored SkinnedMeshRenderer base vector count constant.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • feat(physics): 添加 MeshColliderShape 支持 #2880: Adds mesh-collider support with MeshColliderShape/PhysXMeshColliderShape, modifies Collider to call setWorldScale, adds guards to DynamicCollider.move, and integrates PhysX SIMD runtime loader—directly overlapping implementation of core physics features.
  • Refine MeshColliderShape and add WebAssembly SIMD runtime #2892: Makes parallel changes for PhysX SIMD runtime (physx.release.simd.js), mesh collider shapes (MeshColliderShape classes), PhysXRuntimeMode enhancements, and E2E physics test files—shares identical subsystem additions.

Suggested labels

enhancement, physics

Suggested reviewers

  • luzhuang
  • cptbtptpbcptdtptp

Poem

🐰 SIMD winds blow swift and true,
Mesh colliders twist and turn anew,
Trails curve graceful, assets now embrace,
Lifecycle deferred—destruction finds its place,
Two-point-zero hops into the light! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Update PhysX WASM binaries and CDN URLs' clearly and concisely summarizes the main change: updating WebAssembly binaries and URLs for PhysX, which is directly reflected throughout the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-physx-wasm

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@GuoLei1990 GuoLei1990 changed the base branch from main to dev/2.0 February 28, 2026 18:26
@GuoLei1990 GuoLei1990 changed the title chore: update PhysX WASM binaries and CDN URLs Update PhysX WASM binaries and CDN URLs Feb 28, 2026
@GuoLei1990 GuoLei1990 added physics Engine's physical system ignore for release ignore for release labels Feb 28, 2026
Copy link
Collaborator

@cptbtptpbcptdtptp cptbtptpbcptdtptp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@cptbtptpbcptdtptp cptbtptpbcptdtptp merged commit c588279 into dev/2.0 Mar 1, 2026
9 of 10 checks passed
@github-project-automation github-project-automation bot moved this to In progress in Physic Mar 1, 2026
@github-project-automation github-project-automation bot moved this from In progress to Done in Physic Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation ignore for release ignore for release physics Engine's physical system

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants