113 Commits

Author SHA1 Message Date
hyde zhou 6ccf1cf9a8 Reapply "Feat/plugin support, allow third_party feat(spine) to create plugin f…" (#403) (#424)
This reverts commit 5bcfb9fa04.
2026-11-16 16:33:05 +08:00
hyde zhou 5bcfb9fa04 Revert "Feat/plugin support, allow third_party feat(spine) to create plugin f…" (#403)
This reverts commit a56706c9ad.
2026-11-10 17:04:32 +08:00
Tianze-Chen a56706c9ad Feat/plugin support, allow third_party feat(spine) to create plugin for creator. (#306)
* Add UIMesh component for custom 2D mesh rendering

- Add UIMesh component consuming pre-baked vertex/index/segment data, enabling custom renderers (e.g. spine plugin) to batch through the 2D batcher.
- Export UIMesh from the 2d components index.
- Validate setMeshData input at the boundary (stride, buffer lengths, index values, segment ranges, accessor caps) via engine-standard errorIDs 9010-9017, documented in EngineErrorMap.md.
- Expose StaticVBAccessor per-chunk caps as maxVertexCount/maxIndexCount getters and clamp the 10% reserve to them, so meshes that fit (e.g. 30000 vertices) allocate instead of silently failing.
- Add tests/ui/ui-mesh.test.ts covering the 32767 cap boundary, setMeshData validation, and accessor lifetime.

Also takes over node transform and cascaded opacity: vertices are now always
node-local — UIMesh applies the node's world matrix (unbatched via the
per-draw GPU transform the 2D batcher already maintains for middleware,
batched by baking into the shared chunk copy so draws still merge) and folds
the cascaded UIOpacity into the copied vertex colors itself. The legacy
switches (USE_LOCAL / useLocalData / RenderEntity.setUseLocal) are all derived
internally; consumers never touch them. A JSB staleness poll re-prepares the
native draw infos in the same frame on transform/opacity changes, and a
premultipliedAlpha format declaration drives the opacity fold and the builtin
material's blend factors.

Follow-ups folded in: the opacity fold reads the light color at byte offset 20
(the pos*3f + uv*2f header is 20 bytes), not 16; and UIMesh notifies data
producers through the new onPremultipliedAlphaChanged() hook so subclasses
(e.g. the spine plugin) forward the declared format to their baker instead of
redeclaring the field.

Co-Authored-By: Claude Code <noreply@anthropic.com>

* Disable built-in spine by default; minor editor/build fixes

- Default the built-in Spine feature (spine-3.8) to off in feature cropping, so it is only included when enabled in the editor.
- Recognize scale as a valid spine atlas page attribute in the texture inspector.
- Skip incomplete platform dirs when bundling runtime adapters.

Co-Authored-By: Claude <noreply@anthropic.com>
(cherry picked from commit 7f7922aaf42ff1857f0a6d38970a75d303032f57)

* Export WebAssembly interface under cc.wasm namespace

- Add exports/webassembly.ts re-exporting pal/wasm (instantiateWasm, fetchBuffer, fetchUrl, ensureWasmModuleReady) as the public cc.wasm namespace, so extensions/game code can load their own .wasm files through the engine's platform-adaptive path.
- Expose it as a croppable feature rather than an unconditional export from exports/base.ts: cc.config.json declares a `webassembly` feature and editor/engine-features/render-config.json adds the panel entry (default on, required), so it appears under Project Settings -> Feature Cropping. The label/description are plain text on purpose — i18n:ENGINE.* keys live in the editor package and a custom engine cannot add them.

(cherry picked from commit 92003ab4a21b6ee753cf3ba2ca0f4767658e9cdc)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* feat(simulator): generic native plugin discovery opt-in

The generic plugin discovery chain (cc_gen_plugin_cmake_hook ->
plugins_parser.js -> Pre-AutoLoadPlulgins.cmake -> find_package ->
plugin_registry) already exists and is what native device builds use; the
simulator never invoked it. Wire it in behind an opt-in cache variable, with
no plugin names or plugin logic in the engine — the plugin set is always just
the scan result:

- templates/cmake/common.cmake: cc_gen_plugin_cmake_hook()'s scan roots
  (CC_PLUGIN_PATH) may now be pre-set by the caller; the native-build
  project-layout defaults are unchanged when nobody pre-defines it
- simulator runtime-src CMakeLists.txt: -DSIMULATOR_PLUGIN_SCAN_DIRS="<dir>
  [;<dir>]" scans those roots for cc_plugin.json through the same chain as
  device builds (CC_PROJECT_DIR points into the build tree so the generated
  hook lands there, satisfying the parser's output-dir invariant); unset
  keeps the stock plugin-less simulator, and a cache variable means plain
  `cmake --build` reuses the configured scan
- simulator Game.cpp: call cc_load_all_plugins() after init, mirroring
  BaseGame::init(), so registered plugins' JSB bindings exist before any
  script runs (no-op when no plugins are linked)
- libsimulator protobuf config.h: skip the <hash_map>/<hash_set> defines on
  MSVC >= 1950 (headers removed); stubs fall back to the std::map emulation
  path

Verified end-to-end: a project extensions/ tree scanned at configure time
produces a simulator exe whose plugins register their JSB bindings at startup
(observed live in the simulator's JS context).

Co-Authored-By: Claude Code <noreply@anthropic.com>

---------

Co-authored-by: Developer <developer@cocos.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Engineer <engineer@cocos.com>
2026-11-04 16:41:54 +08:00
llsansun 2157fd176d Multithreading (#322)
* worker pool

* opt

* backup

* worker and worker backend

* worker fallback

* opt

* opt

* remove meta

* opt

* worker export

* testcase fix

* worker js template

* worker pal

* worker opt

* test

* Replace error messages with error codes

* Package size reduction

* Package size reduction

* revert

* Restore editor asset .meta files to the base branch state

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014HAtWwr4dy5azfpccweh1g

* bugfix

* Split into two features: Worker and Worker Pool

* worker option

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 16:35:14 +08:00
James Chen afef795931 Add Sorting2D support. (#18643) 2025-04-22 14:28:55 +08:00
tangkai b08a406d07 Support box2d JS binding which improves the performance of 2D physical system for native platforms . (#18152) 2025-02-24 19:22:06 +08:00
James Chen cf945088ca Add more feature cropping settings for RichText, Mask, Graphics, UISkew, AffineTransform. (#18284)
* Add more feature cropping settings for RichText, Mask, Graphics, UISkew, AffineTransform.
2025-02-10 11:40:01 +08:00
qiuguohua deba073213 Integrate the Google Play Billing Library into engine (#17918) 2024-11-29 11:18:48 +08:00
James Chen 21e6d0c47e fixed #17833: [v3.8.5] Add an ability to load wasm/asmjs module manually (#17844) 2024-11-13 17:17:38 +08:00
James Chen d9daaae301 [v3.8.5] Remove unused exports/wait-for-ammon-instantiation.ts (#17834) 2024-11-12 18:21:46 +08:00
hyde zhou dda764eb21 add post process culling (#17452)
* add post process culling

* disable post-process by default

* remove post process builder

* cleanup

* backward compatible
2024-07-30 13:42:05 +08:00
hyde zhou 0d0a5b0e9c remove Forward Deferred pipelines (#17448) 2024-07-30 11:02:16 +08:00
hyde zhou 8106f8677d add legacy-pipeline culling (#17260) 2024-07-29 16:45:31 +08:00
hyde zhou e9da7e2309 add legacy pipeline (#17250) 2024-07-01 13:57:21 +08:00
GengineJS cf85e35f13 support webgpu (#17096) 2024-06-12 09:24:10 +08:00
Ling Zhan 9a42164966 V3.8.2 physics debug draw (#16325)
* init debug draw

* tweak _debugDrawFlags

* px debug draw performance opt

* tweaks

* add debug draw for physx c++

* debug draw use MainWindow's cameras

* builtin physics draw; WireFrame-->wireframe

* cannon.js supports debug draw

* update engine-native-external --> v3.8.2-5

* tweak

* set engine-native-external --> v3.8.2-5, so that we can pass npm test

* fix: bullet debug draw by default should draw nothing

* comment tweaks

* tweaek

* update native/external-config.json --> 3.8.2-8
2023-09-25 18:05:33 +08:00
Ling Zhan e5488b7d32 V3.8.1 box2d wasm experimental (#15979)
* init

* tsconfig.json

* add box2d-wasm backend to cocos engine. not crash now in 3.8.0.

* rigid-body, collider, and joint works now.

* back

* Joint: SetLinearFrequencyAndDampingRatio

* PhysicsRayCastCallback, PhysicsAABBQueryCallback

* box2d wasm debugDraw

* asm.js

* B2PolygonShape uses B2.ConvexPartition

* box2d wasm contact disabled works now.

* add unit test for physics2d.

* b2ContactListenerWrapper::registerContactFixture

* tweak

* drawPolygon transfer array data from wasm to ts

* tweak

* contact event performance opt

* revert to polygon collider 2d to original implementation. no need for libtess any more.

* PostSolve ContactImpulse use raw pointer.

* TransformVector2; debugDraw supports transform

* enable rtti

* WASM_OBJECT_PTR_2_TS_OBJECT, WASM_OBJECT_PTR_2_WASM_OBJECT

* fix PreSolve parameter oldManifold error

* B2.TransformVector2 --> b2Mul(in ts)

* tweaks: code format.

* eslint

* eslint

* remove physics-2d-box2d-wasm from render-config.json

* comment tweaks

* [opt] debug draw performance opt

* tweaks
2023-08-18 19:30:14 +08:00
Ling Zhan cf8ceed661 V3.8.1 cct trigger (#15613)
* physx ts 支持

# Conflicts:
#	cocos/physics/framework/components/character-controllers/character-controller.ts
#	cocos/physics/framework/components/colliders/collider.ts
#	cocos/physics/physx/physx-world.ts

* add bullet-character-controller trigger events

* physx c++ add cct trigger

* tweaks

* tweaks

* tweaks

* tweak

* tweaks

* physics jsb: emitCCTShapeEvent --> emitCCTCollisionEvent
2023-08-18 10:47:59 +08:00
PP 509d73b27d merge branch v3.8.0-aot (#15421)
* PR1: add explicit function return type (#15311)

* PR4: add explicit function return type (#15314)

* [ci skip][AUTO]: Automated code generating update: 8843bfe54cd3f8e6f84432948716c8d130ecb233  (#15314) (#15357)

Co-authored-by: cocos-robot <cocos-robot@cocos.com>

* add function return type

* fix version checking

* fix return type

---------

Co-authored-by: Cocos Robot <48829427+cocos-robot@users.noreply.github.com>
Co-authored-by: cocos-robot <cocos-robot@cocos.com>
2023-06-13 18:08:45 +08:00
yinkaile 1913ee9edf fixed transparency pass with post process pipeline (#15139) 2023-05-23 15:45:01 +08:00
Yiwen 5330e7ee5a Configurable constraint (#14778)
* add support to configurable constraint

* add missing files

* update packages

* fix PhysX bugs,update error info

* fix exports, deserialization.

* just stage

* Revert "just stage"

This reverts commit 41dc157afec00bfeb077b12e64c45a951ab1f894.

* fix problems

* improve perf

* tweak

* fix merge errors

* update errormap
2023-05-19 11:28:09 +08:00
Ling Zhan 1032bd9508 Sweep Test (#15068)
* init

# Conflicts:
#	cocos/physics/physx/physx-adapter.ts

# Conflicts:
#	cocos/physics/physx/physx-adapter.ts

* init sweepBoxClosest

# Conflicts:
#	cocos/physics/physx/physx-world.ts

* back

* physx boxCastClosest works now.

* add physx sweepAll

* init bullet sweepBoxClosest. not test yet

* add bullet sweepBox

* bullet add internal functions: sweep/sweepClosest

* init physx c++ sweepBox/sweepBoxClosest

* add sweepSphere, sweepCapsule; add unit test.

* add sweep api doc

* revert physx asm/wasm loading func

* tweaks

* add error log for builtin and cannon.js

* builtin and cannon.js use warnid when calling sweep

* tweak api doc
2023-05-17 18:37:03 +08:00
Ling Zhan 9cd5212d18 Character Controller (#14848)
* back.boxCCT works now. capsuleCCT not collider correctly

* refactor

* cct 事件系统初步可用。todo 碰撞filter

* init cct group and mask

* queryFilterCB

* this the first working version

* tweaks

* init bullet character controller. todo: events, autoStep bug, maxSlope bug

* bullet cct onShapehit

* physx native works now. todo: BoxCharacterController

* add physx-native BoxCharacterController

* cct filters redundant events

* cct velocity

* cct detectCollision not working

* cct detectCollisions works in physx

* Character controller supports setDetectCollisions: collision detection without calling move()

* cct center

* bt.CharacterController_setContactOffset,CharacterController_setStepOffset,CharacterController_setSlopeLimit

* bullet cct collision event use last shoot

* tweaks

* cct doc

* fix bullet box-cct hit callback

* add cct export

* feat cct setOverlapRecovery

* cct delete useless code in native physics

* tweaks: cct remove useless code

* fix cct bullet group mask: update group and mask by re-adding cct to physics world. not tested

* tweaks

* tweaks

* fix bullet-cct not emit collision: add bullet updateNeedEmitCCTEvents

* tweaks

* fix cct supports enable/disable

* add cct imp null check

* cct not to expose detectCollisions and OverlapRecovery at this moment

* physx/bullet cct支持节点缩放.todo: bullet cct(setRadius/Height)还有bug 无法运行时改变,只能在初始化的时候设定。physx c++待支持。

* c++ physx cct supports node scale

* fix cct physics c++ forgets to remove cct from scene when destroyed

* [fix] physx cct set climbing mode to PxCapsuleClimbingMode.eCONSTRAINED

* add cct unit test and multiple tweaks

* multiple tweaks and add cct center for physx c++

* tweak

* tweaks

* tweaks

* external version: develop-20

* tweaks
2023-05-16 10:03:13 +08:00
jk20012001 d110e48a88 add post process manager and component (#14916) 2023-05-04 18:38:13 +08:00
Yiwen 3713957624 collider constraint (#14068)
* collider constraint

* rm uncessary function import

* bullet doesn't prevent dynamic rigid body using simplex collider

* convex mesh with dynamic rigid body is allowed

* clear useless imports
2023-04-20 14:32:48 +08:00
hyde zhou bcc22893b2 fix custom pipeline init (#14353) 2023-02-24 16:06:32 +08:00
hyde zhou 6dd16771cb [pipeline] enable custom pipeline in editor (#14084)
* enable custom pipeline in editor

* always enable in runtime
2023-02-01 17:38:04 +08:00
hyde zhou 2a48624a74 disable custom pipeline in editor (#14077) 2023-01-17 11:37:35 +08:00
江战 f6854cd16e native introduce jsb.window (#13816) 2022-12-16 13:50:59 +08:00
fqamic d4055f7e32 new basic capabilities of supporting handset ar and webxr (#13420)
* feat: add the basic capability of handset ar native

* feat: add handset input device, for ar camera pose

* feat: native pack tool supports xr platform name

* feat: web gl context supports webxr

* feat: webxr has been converted to screen coordinates via camera

* fix: pr ts-expect-error undefined xr

* feat: support webxr, and remove ar redundant code

* fix:xr-spaces gradlew permission error

* feat: revert redundant ar engine feature

* fix: eslint check error

* feat: remove redundant code

* fix: eslint check warning

* adjust armodule process in forward stage, mtl texture and jsb

* fix: exlint warning, and add license

* adjust ar lib and interfaces

* change webxr check interface

* merge external arlib header and move it to engine

* improve: update native external version

* move ar background stage to xr/rendering and move its init to webxr device in xr plugin

* fix format error

* fix format error

* adjust jsb_ar_manual, ARModule, ARBackground

* adjust arbackground

Co-authored-by: Parryzhai <1306895355@qq.com>
Co-authored-by: MoHai <1192652394@qq.com>
2022-11-24 13:33:50 +08:00
hyde zhou 92f2d08f52 [develop] update layout graph loading (#13368) 2022-11-18 13:43:18 +08:00
hyde zhou d33798f895 [develop] update native pipeline (#13270) 2022-11-11 22:51:31 +08:00
minggo 2e29bce9c3 Adjust serialization (#13201)
* move serialization related file into cocos/serialization
2022-11-01 17:10:12 +08:00
minggo 83a2717fac Fix module import (#13140)
* fix core module import style

* import murmurhash2_32_gc from core module

* do not export visibleRect
2022-10-25 16:38:38 +08:00
李吉林 55fc0319d6 export light probe symbols (#13116) 2022-10-21 10:17:09 +08:00
李吉林 a9d4e13f85 Light probe merge (#13093)
* add light probe
2022-10-19 22:34:21 +08:00
fqamic cca8ff36e3 feat: feature cropping for xr and ar, add xr environment constant. (#13032) 2022-10-14 15:52:41 +08:00
hyde zhou 5b37954c7f [develop] change custom builder setup procedure (#12990) 2022-10-09 16:14:59 +08:00
minggo 95a76235b6 Adjust some files (#12910)
`cocos/core` should not depend other modules, so move some files out of `cocos/core`:
- move some files from `cocos/core` to `cocos/game`
  - director.ts
  - splash-screen.ts
  - game.ts
 - move `cocos/core/root.ts` to `cocos/root.ts` as there is not better module to contain `root.ts`.
 - move `cocos/core/platform/view.ts` to `cocos/ui/view.ts` as screen related logic is moved to `cocos/core/platform/screen.ts`
2022-09-28 09:34:35 +08:00
hyde zhou e8366a7a7b [develop] custom pipeline startup refactoring (#12886)
* manually merge bloom, fg culling, native pipeline updates

* fix lint

* camera usage added

* use parent name instead of default & add some phase names

* adding render graph execution

* execute render graph added

* refactoring workflow

* uses interface instead of abstract class

* add setup step

* camera usage added

* adding setup stage

* unify camera get set

* adding ppl setup

* fixed bloom effect

* change descriptor merge

* modify uniform collect as descriptor

* revert

* revert phase

* adding render callback

* update setup workflow

* pipeline builder updated

* refactoring native pipeline setup

* revert jsb

* improve cameraList clear

Co-authored-by: zxx43 <zxx43@hotmail.com>
Co-authored-by: qiuguohua <>
2022-09-27 17:57:21 +08:00
minggo 0d7c5c8f56 move cocos/core/scene-graph to cocos/scene-graph (#12868)
* move `cocos/core/scene-graph` to `cocos/scene-graph`
* move some files in `cocos/core/components` to `cocos/scene-graph`:
  - component.ts
  - component-event-handler.ts
  - component-event-handler-schema.ts
* move some files in `cocos/core/components` to `cocos/misc`: 
  - missing-script.ts
  - model-renderer.ts
  - renderer.ts
  - camera-component.ts
* move  `cocos/core/components/system.ts` to ``cocos/core/system.ts``
2022-09-26 11:02:22 +08:00
minggo bd0fcc67c4 move cocos/core/pipeline to cocos/rendering (#12797)
* move cocos/core/pipeline to cocos/rendering
2022-09-16 16:10:26 +08:00
ChiaNing 2afd02e711 sorting component add (#12465)
* sorting component add

* menu add

* change sorting layer type to enum

* import fix

* name change

* sorting init

* fix init

* update priority on editor

* add enum index

* sort fix

* api doc add

* remove export to cc

* doc change

* protect

* warn id

Co-authored-by: ChiaNing <sun.clooud.mo@gmail.com>
2022-09-15 10:15:33 +08:00
minggo 4261ccae76 move cocos/core/renderer to cocos/render-scene (#12729)
* move cocos/core/renderer to cocos/render-scene

* fix compiling error on native
2022-09-09 18:19:06 +08:00
minggo 2f10f48c15 adjust some folders (#12712)
move cocos/core/asset-manager to cocos/asset/asset-manager
move cocos/core/assets to cocos/asset/assets
merge cocos/core/builtin to cocos/asset/asset-manager
2022-09-07 18:45:54 +08:00
minggo 7922834c0b move cocos/core/animation to cocos/animation (#12674) 2022-09-05 14:57:37 +08:00
minggo c5c7b987ea move cocos/core/gfx to cocos/gfx (#12559)
* move cocos/core/gfx to cocos/gfx
2022-08-26 17:51:46 +08:00
QingliWang 6a8f53b186 Add features for XR developement. (#12413)
* Change Android mainloop, add global config and template projects for XR.

* Change gfx/gles device's process flow for XR, working with other PRs, waiting.

* Change gfx/Vulkan device's process flow for XR, working with other PRs, waiting.

* Change render process for XR.

* Develop XR input and events.

* Develop 3D feature of UI widgets and raycast effect for XR.

Co-authored-by: fqamic <fqamic@vip.qq.com>
2022-08-22 16:34:45 +08:00
PP 73673aba9e fix native module building for separate engine (#12251)
* fix native module building

* fix typedoc
2022-07-28 18:55:14 +08:00
李吉林 a8fc7ae64a V3.6.0 debug renderer build warning (#11968)
* delete debug-renderer empty exporter
2022-07-13 17:13:41 +08:00