avbd-babylon 0.1.0 → 0.2.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.
@@ -1,6 +1,10 @@
1
1
  export function createWebGPUDevice(options?: {
2
+ /** Run the cached 3D floor-contact qualification and select a working GPU path. */
3
+ validate3D?: boolean;
2
4
  powerPreference?: GPUPowerPreference;
3
5
  requiredLimits?: Record<string, number>;
4
6
  /** Desired maximum capacities, clamped to the adapter. Required limits take precedence. */
5
7
  preferredLimits?: Record<string, number>;
6
8
  }): Promise<{ adapter: GPUAdapter; device: GPUDevice }>;
9
+ /** Prepare an existing renderer-owned device for 3D. Does not take device ownership. */
10
+ export function prepareWebGPUDevice3D(device: GPUDevice): Promise<GPUDevice>;
package/dist/native.js CHANGED
@@ -1 +1 @@
1
- export { AvbdScene2D, AvbdScene3D, createWebGPUDevice } from "./avbd.js";
1
+ export { AvbdScene2D, AvbdScene3D, createWebGPUDevice, prepareWebGPUDevice3D } from "./avbd.js";
@@ -16,6 +16,14 @@ last argument when their mesh belongs to the world’s scene. Both `AvbdShapeTyp
16
16
  and the supported Babylon `PhysicsShapeType` enum values work. Pass
17
17
  `autoAttach: false` when you manage stepping yourself.
18
18
 
19
+ `AvbdPhysics.create()` checks 3D floor contacts once per device and automatically
20
+ selects a working GPU path. This covers Android drivers that need compatible
21
+ contact calculations or smaller hull workgroups. Desktop devices that pass
22
+ retain their normal shaders and dispatches. The check adds no per-step readbacks.
23
+ For native 3D solvers, use `createWebGPUDevice({validate3D:true})`, or await
24
+ `prepareWebGPUDevice3D(device)` before using a renderer-owned device. Preparation
25
+ is cached and preserves device ownership. 2D does not require the 3D check.
26
+
19
27
  ```js
20
28
  import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
21
29
  import { AvbdPhysics, AvbdPhysicsAggregate, AvbdShapeType } from "avbd-babylon";
package/docs/RELEASE.md CHANGED
@@ -1,6 +1,6 @@
1
- # First release checks
1
+ # Release checks
2
2
 
3
- AVBD 0.1 provides GPU rigid-body physics in 2D and 3D, the Babylon aggregate API,
3
+ AVBD 0.2 provides GPU rigid-body physics in 2D and 3D, the Babylon aggregate API,
4
4
  portable scene builders and the browser demos. The package ships ESM, the `AVBD`
5
5
  browser global, declarations, documentation and license notices. It has no runtime
6
6
  dependencies; Babylon 9 is an optional peer for the integration API.
@@ -23,6 +23,38 @@ playable scenes, screenshots, controls and reports. A Chromium browser with
23
23
  WebGPU is required for GPU tests; unsupported hardware fails explicitly. GPU
24
24
  workloads run sequentially. Type and packaging checks do not need a GPU.
25
25
 
26
+ Run `npm run test:mobile-contacts` for the 3D floor-contact portability checks,
27
+ including eight/nine storage-buffer limits and both renderers in a mobile layout.
28
+ The layout checks use the test computer's GPU. Test the hosted demo on actual
29
+ phones as well; its **GPU contact check** sidebar can save a diagnostic report
30
+ with floor-contact results, browser details and device limits. Failed devices
31
+ test alternatives for contact data/calculations, work sharing and collision search.
32
+ A fallback is used only after its known-overlap and falling-shape checks pass.
33
+ GPUs that pass the normal path keep the batched execution and automatic scene
34
+ selection. The diagnostic report compares the contact inputs, stabilization
35
+ setting and calculated forces on the GPU.
36
+
37
+ For an authorized connected Android phone, start the local demo, unlock the phone
38
+ and open a canonical scene in its browser. Forward the browser debugging socket
39
+ and reverse the demo port with ADB:
40
+
41
+ ```sh
42
+ adb reverse tcp:8080 tcp:8080
43
+ adb forward tcp:9223 localabstract:chrome_devtools_remote
44
+ node scripts/check-connected-contacts.mjs
45
+ ```
46
+
47
+ This checks physical-device floor contacts, 2D/3D package features and both 3D
48
+ collision searches. It uses only the existing local demo tab and saves
49
+ `test-results/connected-phone-contacts.json`. Mobile viewport tests and physical
50
+ phone tests have separate reports.
51
+
52
+ To compare PC performance with a saved package build, run
53
+ `node scripts/check-contact-performance.mjs --baseline=/path/to/avbd.js`.
54
+ It runs 10K and 100K native 3D bodies with five iterations, three alternating
55
+ repeats and no rendering or sleeping. It checks identical dispatch sequences,
56
+ matching selected physics states, GPU times and CPU submission times.
57
+
26
58
  Run `npm run benchmark:native` to refresh the three-repeat 2D/3D measurements
27
59
  for bulk movement/spin, property edits, grouped queries, selected reads and
28
60
  sleeping. The browser performance page uses the same package APIs as the demos.
@@ -53,6 +85,13 @@ Preview either cleanup with `node scripts/clean-results.mjs` or
53
85
  The package check installs the tarball in a temporary project and imports it
54
86
  without Babylon or a DOM. It verifies the production file list, both builds,
55
87
  optional-peer behavior, strict portable TypeScript usage and upstream notices.
88
+
89
+ After publishing, run `npm run test:published -- 0.2.0` to verify the registry
90
+ release. This installs the exact version in a fresh temporary project, verifies
91
+ its registry integrity, imports ESM/native and browser-global exports, checks
92
+ TypeScript usage, and runs the GPU package feature tests with Babylon installed
93
+ explicitly for those integration checks. It uses the downloaded package rather
94
+ than a local build and saves `test-results/published-package.json`.
56
95
  `avbd-babylon/native` provides portable imports without Babylon type dependencies.
57
96
  Packed files exclude the website,
58
97
  benchmark outputs, test fixtures, development tools and dependency directories.
@@ -67,7 +106,13 @@ premade results. Those saved results identify the RTX 4070 Laptop GPU. Live
67
106
  benchmarks measure the visitor's machine. The paper's desktop RTX 4090 figures
68
107
  are separate comparisons with different hardware and reconstructed workloads.
69
108
 
70
- ## Publish 0.1.0
109
+ The repository's `netlify.toml` runs `npm run build:all` and publishes the root,
110
+ so the demo, benchmark pages, assets and reports stay available. `npm run build`
111
+ builds the npm library only; use `npm run build:all` or `npm run build:web` before
112
+ a manual website upload. Push the Netlify configuration and source changes,
113
+ then redeploy. Clearing browser data cannot update an older deployed bundle.
114
+
115
+ ## Publish 0.2.0
71
116
 
72
117
  Push the sources, documentation and `test-results/` screenshots to the public
73
118
  [repository](https://github.com/joshbrew/babylon-avbd) before publishing npm.
@@ -96,7 +141,7 @@ aggregates, sleeping, hinge angle stops, ropes, ragdolls and fabric helpers.
96
141
  attachment for timing and cleanup. Attachment does not create rendering meshes.
97
142
  See the [feature table](../README.md#feature-coverage) for exact coverage.
98
143
 
99
- These remain useful follow-up work rather than supported 0.1 features:
144
+ These remain useful follow-up work rather than supported 0.2 features:
100
145
 
101
146
  - **Concave mesh collisions:** custom hulls fill cavities. Terrain and hollow
102
147
  objects need suitable convex pieces.
package/package.json CHANGED
@@ -1,66 +1,10 @@
1
1
  {
2
2
  "name": "avbd-babylon",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "GPU AVBD rigid-body physics with a Babylon.js aggregate API",
5
- "keywords": [
6
- "avbd",
7
- "webgpu",
8
- "physics",
9
- "babylonjs"
10
- ],
11
- "homepage": "https://github.com/joshbrew/babylon-avbd#readme",
12
- "bugs": {
13
- "url": "https://github.com/joshbrew/babylon-avbd/issues"
14
- },
15
- "repository": {
16
- "type": "git",
17
- "url": "git+https://github.com/joshbrew/babylon-avbd.git"
18
- },
19
- "license": "MIT",
20
- "author": "josh brewster et al",
21
- "type": "module",
22
- "exports": {
23
- ".": {
24
- "types": "./dist/avbd.d.ts",
25
- "import": "./dist/avbd.js",
26
- "default": "./dist/avbd.js"
27
- },
28
- "./native": {
29
- "types": "./dist/native.d.ts",
30
- "import": "./dist/native.js",
31
- "default": "./dist/native.js"
32
- },
33
- "./global": {
34
- "types": "./dist/avbd.global.d.ts",
35
- "default": "./dist/avbd.global.js"
36
- },
37
- "./package.json": "./package.json"
38
- },
39
5
  "main": "./dist/avbd.js",
40
6
  "types": "./dist/avbd.d.ts",
41
- "directories": {
42
- "doc": "docs",
43
- "test": "tests"
44
- },
45
- "files": [
46
- "dist/avbd.js",
47
- "dist/avbd.global.js",
48
- "dist/avbd.global.d.ts",
49
- "dist/avbd.d.ts",
50
- "dist/babylonAvbd.d.ts",
51
- "dist/nativeScenes.d.ts",
52
- "dist/native.js",
53
- "dist/native.d.ts",
54
- "dist/gpuDevice.d.ts",
55
- "dist/NOTICE",
56
- "LICENSE",
57
- "README.md",
58
- "docs/README.md",
59
- "docs/BABYLON_API.md",
60
- "docs/HPLOC.md",
61
- "docs/RELEASE.md",
62
- "tests/README.md"
63
- ],
7
+ "type": "module",
64
8
  "scripts": {
65
9
  "start": "node scripts/build-library.mjs && node scripts/build.mjs --serve",
66
10
  "build": "node scripts/build-library.mjs",
@@ -88,18 +32,23 @@
88
32
  "clean:results": "node scripts/clean-results.mjs --apply",
89
33
  "clean:dist": "node scripts/clean-dist.mjs --apply",
90
34
  "test:package": "node scripts/check-package.mjs",
35
+ "test:published": "node scripts/check-published.mjs",
36
+ "test:mobile-contacts": "node scripts/build.mjs && node scripts/check-contact-portability.mjs && node scripts/check-contact-compatibility-features.mjs",
91
37
  "test:types": "tsc --noEmit --strict --skipLibCheck --module nodenext --target es2022 tests/package-api-types.ts",
92
38
  "benchmark:native": "node scripts/benchmark-package.mjs",
93
39
  "benchmark:sleeping": "node scripts/benchmark-package.mjs",
94
40
  "benchmark:native-edits": "node scripts/check-native-performance.mjs",
95
- "benchmark:renderers": "node scripts/build.mjs && node scripts/benchmark-renderers.mjs"
41
+ "benchmark:renderers": "node scripts/build.mjs && node scripts/benchmark-renderers.mjs",
42
+ "test:connected-phone": "node scripts/check-connected-contacts.mjs"
96
43
  },
97
- "devDependencies": {
98
- "esbuild": "^0.28.2",
99
- "prettier": "^3.9.9",
100
- "tinybuild": "^1.0.6",
101
- "@babylonjs/core": "^9.13.0",
102
- "typescript": "^7.0.2"
44
+ "license": "MIT",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/joshbrew/babylon-avbd.git"
48
+ },
49
+ "homepage": "https://github.com/joshbrew/babylon-avbd#readme",
50
+ "bugs": {
51
+ "url": "https://github.com/joshbrew/babylon-avbd/issues"
103
52
  },
104
53
  "peerDependencies": {
105
54
  "@babylonjs/core": "^9.13.0"
@@ -109,7 +58,56 @@
109
58
  "optional": true
110
59
  }
111
60
  },
61
+ "keywords": [
62
+ "avbd",
63
+ "webgpu",
64
+ "physics",
65
+ "babylonjs"
66
+ ],
67
+ "devDependencies": {
68
+ "esbuild": "^0.28.2",
69
+ "prettier": "^3.9.9",
70
+ "tinybuild": "^1.0.6",
71
+ "@babylonjs/core": "^9.13.0",
72
+ "typescript": "^7.0.2"
73
+ },
112
74
  "module": "./dist/avbd.js",
75
+ "exports": {
76
+ ".": {
77
+ "types": "./dist/avbd.d.ts",
78
+ "import": "./dist/avbd.js",
79
+ "default": "./dist/avbd.js"
80
+ },
81
+ "./native": {
82
+ "types": "./dist/native.d.ts",
83
+ "import": "./dist/native.js",
84
+ "default": "./dist/native.js"
85
+ },
86
+ "./global": {
87
+ "types": "./dist/avbd.global.d.ts",
88
+ "default": "./dist/avbd.global.js"
89
+ },
90
+ "./package.json": "./package.json"
91
+ },
92
+ "files": [
93
+ "dist/avbd.js",
94
+ "dist/avbd.global.js",
95
+ "dist/avbd.global.d.ts",
96
+ "dist/avbd.d.ts",
97
+ "dist/babylonAvbd.d.ts",
98
+ "dist/nativeScenes.d.ts",
99
+ "dist/native.js",
100
+ "dist/native.d.ts",
101
+ "dist/gpuDevice.d.ts",
102
+ "dist/NOTICE",
103
+ "LICENSE",
104
+ "README.md",
105
+ "docs/README.md",
106
+ "docs/BABYLON_API.md",
107
+ "docs/HPLOC.md",
108
+ "docs/RELEASE.md",
109
+ "tests/README.md"
110
+ ],
113
111
  "sideEffects": false,
114
112
  "unpkg": "./dist/avbd.global.js",
115
113
  "jsdelivr": "./dist/avbd.global.js"
package/tests/README.md CHANGED
@@ -13,6 +13,8 @@ checks run on the host because they inspect files and JavaScript APIs.
13
13
  | `npm run test:castle` | Mortar settling, local impacts, rotating debris and responsive layout |
14
14
  | `npm run test:cloth` | Thirty-second limb/net checks, central cloth tearing and screenshots |
15
15
  | `npm run test:features` | 2D/3D hinge stops, motor reversal/braking, sensors, live masks and casts |
16
+ | `npm run test:mobile-contacts` | 3D floor contacts, device-verified fallback selection, 8/9 binding limits and mobile drawing |
17
+ | `npm run test:connected-phone` | Physical Android GPU: prepared native/Babylon APIs, floor contacts, 2D/3D features and grid/HPLOC++ collisions |
16
18
  | `npm run test:renderers` | Every canonical scene and the slingshot in Babylon; shared-state renderer benchmark checks |
17
19
  | `npm run benchmark:renderers` | Direct WebGPU versus Babylon: GPU drawing/copies, CPU submission and completion; three repeats |
18
20
  | `npm run test:fracture` | Voronoi partition, breakable face bonds, wrecking-ball impact and persistent rubble |