pelican-engine 0.3.24 → 0.3.25
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/distribution.json +9 -9
- package/docs/STATUS.md +2 -0
- package/docs/api/REFERENCE.md +2 -2
- package/docs/api/index.json +2 -2
- package/engine.manifest.json +1 -1
- package/lib/sdk/index.d.ts +1 -1
- package/lib/sdk/index.js +1 -1
- package/lib/simulation/cloth-plugin.js +40 -7
- package/package.json +1 -1
package/distribution.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"format": "pelican.npm-distribution",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.25",
|
|
4
4
|
"files": {
|
|
5
5
|
"AGENTS.md": "817bf14a6fe341bf515625cd84a0df4e6512a74b4a426ae3232ae3ad50e09d73",
|
|
6
6
|
"CONTRIBUTING.md": "0ffad5d841d90f319fc50a75b81d3c0ad6dab8d5d9bec2846c65c7f8358d5a50",
|
|
7
7
|
"docs/AI-WORKFLOW.md": "aa992686df93f791795f6f3fce01713d812eea6a1b9556f07411ac5847278efa",
|
|
8
|
-
"docs/api/index.json": "
|
|
9
|
-
"docs/api/REFERENCE.md": "
|
|
8
|
+
"docs/api/index.json": "2957e732dd52aa0aab9127beaf7051a0ebb6a6d7005a2660b1ed532551d82fe7",
|
|
9
|
+
"docs/api/REFERENCE.md": "f74d7569fac4e922245f36ef52ccb387ca792c6b00b3664334a0423ddbac9355",
|
|
10
10
|
"docs/ARCHITECTURE.md": "3184b73592d466390e7793b1cf39bbb80d6052b523fba7e7cb377b5207074627",
|
|
11
11
|
"docs/assets/pelican-mark.svg": "407b10cd7e292ea83cf5dba4046fb2f01c7d566a14014c55deda3a2984562b4d",
|
|
12
12
|
"docs/CAPABILITIES.md": "92950817497d8c63db07830db96dc93c877befa8d038320feed1ae1f1a053cb1",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"docs/PHYSICS-LIFECYCLE-ISSUE.md": "cc78917462de4e7e9b68e77c742192ce213b4be5b516d2ba943251fff46977ac",
|
|
20
20
|
"docs/RENDER-BACKENDS.md": "d981ea94742a835d028db37d536fb7fba05102e37bc6274a37baf74f5034b954",
|
|
21
21
|
"docs/ROADMAP.md": "29ac1c54f36064e23c17cfe7f549d6860889257a57d1227e322958aa9c281568",
|
|
22
|
-
"docs/STATUS.md": "
|
|
22
|
+
"docs/STATUS.md": "78a7236755ffd52fd4e4b7a8347452b4f806cf167b56e6464d3a1fb3e48ade56",
|
|
23
23
|
"docs/THIRD-PARTY-NOTICES.md": "58f9b72e2b4dfaaaf2a4c08b9bde9ecef3d2b7e7d65fccd782ed54f39fa76fdc",
|
|
24
|
-
"engine.manifest.json": "
|
|
24
|
+
"engine.manifest.json": "4c5718b7bbf53ef6a76f0530a494594682cf2902d78516b30a71a74ab4592a0b",
|
|
25
25
|
"lib/assets/audio.js": "6facdce4e053afd172af5b9407569b035169844ea17b49f93f8b67f72b78895f",
|
|
26
26
|
"lib/assets/errors.js": "70572678655c6e53179d31920d71f29882d373a0e12d560220bb0fc2cd74f2cc",
|
|
27
27
|
"lib/assets/glb.js": "b808479a36299c154db97f50c16863a3b5a2c61f725e66bf01d01a5f62a288a5",
|
|
@@ -125,9 +125,9 @@
|
|
|
125
125
|
"lib/runtime/world.js": "c43621fbaca8bd2b0d6477a96e60e895312f0f7b1eb97614b6e4f9b716129ea1",
|
|
126
126
|
"lib/schema/index.js": "594429eecb4494c4af2f3d04537be3211f2c9297a1fc555bbba5d028d8627965",
|
|
127
127
|
"lib/sdk/graph-values.js": "a58c00f127cb82aba5fd2824981942844e06d9a59a88a05e35d1d3df2fc7ed2f",
|
|
128
|
-
"lib/sdk/index.d.ts": "
|
|
129
|
-
"lib/sdk/index.js": "
|
|
130
|
-
"lib/simulation/cloth-plugin.js": "
|
|
128
|
+
"lib/sdk/index.d.ts": "efd79c42d516414b1957241dae460111ea46a83c0de83811152b70e7084e7119",
|
|
129
|
+
"lib/sdk/index.js": "2c57acadcd82609fc269cc5c53b36ceba94aa7cc1d3bc449e1eeed371c3e734b",
|
|
130
|
+
"lib/simulation/cloth-plugin.js": "b3f9869cdc145c3e3faff034cca7de0a9e0e39bb04a6956a626541678f730da8",
|
|
131
131
|
"lib/simulation/cloth.js": "449be6f517af4eddbf047db68495e8f7666416d18b048b9f113064e0b07cc154",
|
|
132
132
|
"lib/simulation/rope-body-coupling.js": "70694b73d17c79f223803a51fbf4a4dae551b717cd29bbea1fa38386ac98d621",
|
|
133
133
|
"lib/simulation/rope-plugin.js": "08c7c4800053b3e8f255b6dd5be2b532b8e259300666c31de5494d15704717d4",
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
"licenses/undici-types/LICENSE": "a6db8096b2707bc0102d256917d4d33f298ba36d8c3f25de067a2b5bb379db27",
|
|
204
204
|
"licenses/uniq/LICENSE": "e67aed7df22dc8031e4fcf5338fe91cb33e3817e5c58a99a2a2802eea9069791",
|
|
205
205
|
"licenses/vite/LICENSE.md": "a22152baa1aef74402443008e767e7c689a524c0909d19b0431d97f5ab066a13",
|
|
206
|
-
"package.json": "
|
|
206
|
+
"package.json": "c120b153fae8f8e52430f8e1a4d481611ccfd933bbf6d9f622c9af3baf92ea6a",
|
|
207
207
|
"README.md": "ff25e039921a85ba253c27608c77ed614a036117d7a04f908a78d1e3ed3f19ef",
|
|
208
208
|
"web/index.html": "d89d6a5b5be3beae3627a8ed506ac308b165d264fb8696be3afd79fcca2f26ee"
|
|
209
209
|
}
|
package/docs/STATUS.md
CHANGED
package/docs/api/REFERENCE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# pelican 0.3.
|
|
1
|
+
# pelican 0.3.25 API 索引
|
|
2
2
|
|
|
3
3
|
Installed declarations: `lib/sdk/index.d.ts` (relative to the package root).
|
|
4
4
|
The signatures below come from the same public SDK source as repository games.
|
|
@@ -11,7 +11,7 @@ Source-file paths and line numbers are build-time provenance only; TypeScript so
|
|
|
11
11
|
来源:`packages/sdk/src/index.ts:2`
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
|
-
SDK_VERSION = "0.3.
|
|
14
|
+
SDK_VERSION = "0.3.25"
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Vec2
|
package/docs/api/index.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"format": "pelican.api-index",
|
|
3
3
|
"version": 1,
|
|
4
|
-
"engineVersion": "0.3.
|
|
4
|
+
"engineVersion": "0.3.25",
|
|
5
5
|
"entry": "pelican-engine",
|
|
6
6
|
"source": "packages/sdk/src/index.ts",
|
|
7
7
|
"symbols": [
|
|
8
8
|
{
|
|
9
9
|
"name": "SDK_VERSION",
|
|
10
10
|
"kind": "constant",
|
|
11
|
-
"signature": "SDK_VERSION = \"0.3.
|
|
11
|
+
"signature": "SDK_VERSION = \"0.3.25\"",
|
|
12
12
|
"line": 2
|
|
13
13
|
},
|
|
14
14
|
{
|
package/engine.manifest.json
CHANGED
package/lib/sdk/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Pelican Engine public API. No renderer or GPU implementation types escape this module. */
|
|
2
|
-
export declare const SDK_VERSION = "0.3.
|
|
2
|
+
export declare const SDK_VERSION = "0.3.25";
|
|
3
3
|
export type Vec2 = readonly [number, number];
|
|
4
4
|
export type Vec3 = readonly [number, number, number];
|
|
5
5
|
export type Vec4 = readonly [number, number, number, number];
|
package/lib/sdk/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolveEntityDefinition } from "../runtime/prefabs.js";
|
|
1
2
|
import { cloneSerializable } from "../runtime/random.js";
|
|
2
3
|
import { createCloth } from "./cloth.js";
|
|
3
4
|
const fail = (code, detail) => { throw new Error(`TC_CLOTH_${code}: ${detail}`); };
|
|
@@ -68,6 +69,22 @@ function createEntry(input, fixedDt, materials, restoredSelfMode, restoredSurfac
|
|
|
68
69
|
}
|
|
69
70
|
function disposeEntries(entries) { for (const entry of entries.values())
|
|
70
71
|
entry.solver.dispose(); entries.clear(); }
|
|
72
|
+
function validateBodyBindings(entries, context, world) {
|
|
73
|
+
const records = world ? new Map(world.entities.map(record => [record.id, record])) : undefined;
|
|
74
|
+
const bridge = [...entries].some(entry => (entry.definition.bodyColliders?.length ?? 0) > 0)
|
|
75
|
+
? context.getRopePhysicsBridge?.() : undefined;
|
|
76
|
+
for (const entry of entries)
|
|
77
|
+
for (const binding of entry.definition.bodyColliders ?? []) {
|
|
78
|
+
const record = records?.get(binding.entity);
|
|
79
|
+
if (records && (!record || !resolveEntityDefinition(context.scene, record)?.rigidBody))
|
|
80
|
+
fail("SNAPSHOT", `Bound body '${binding.entity}' is missing from the restored world.`);
|
|
81
|
+
if (!context.world.isAlive(binding.entity))
|
|
82
|
+
fail("BODY_COLLIDER", `Body '${binding.entity}' is not a live entity.`);
|
|
83
|
+
if (!bridge)
|
|
84
|
+
fail("BODY_COLLIDER", "Body bindings require the physics plugin.");
|
|
85
|
+
bridge.sampleSphere(binding.entity);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
71
88
|
function parseSnapshot(value, fixedDt, materials) {
|
|
72
89
|
if (!value || typeof value !== "object" || value.version !== 1 || !Array.isArray(value.cloths) || value.cloths.length > 256)
|
|
73
90
|
return fail("SNAPSHOT", "Expected a version 1 snapshot containing at most 256 cloths.");
|
|
@@ -118,12 +135,7 @@ export const createClothPlugin = context => {
|
|
|
118
135
|
return fail("CAPACITY", "At most 256 cloths per host.");
|
|
119
136
|
const entry = createEntry(definition, hostDt, materials);
|
|
120
137
|
try {
|
|
121
|
-
|
|
122
|
-
for (const binding of entry.definition.bodyColliders ?? []) {
|
|
123
|
-
if (!context.world.isAlive(binding.entity))
|
|
124
|
-
return fail("BODY_COLLIDER", `Body '${binding.entity}' is not a live entity.`);
|
|
125
|
-
bridge?.sampleSphere(binding.entity);
|
|
126
|
-
}
|
|
138
|
+
validateBodyBindings([entry], context);
|
|
127
139
|
entries.set(entry.definition.id, entry);
|
|
128
140
|
}
|
|
129
141
|
catch (error) {
|
|
@@ -200,7 +212,28 @@ export const createClothPlugin = context => {
|
|
|
200
212
|
snapshot: () => ({ version: 1, cloths: [...entries.values()].sort((a, b) => a.definition.id < b.definition.id ? -1 : a.definition.id > b.definition.id ? 1 : 0)
|
|
201
213
|
.map(({ definition, solver }) => ({ definition: cloneSerializable(definition), state: solver.snapshot() })) }),
|
|
202
214
|
validateSnapshot(value) { const staged = parseSnapshot(value, hostDt, materials); disposeEntries(staged); },
|
|
203
|
-
|
|
215
|
+
validateWorld(value, world) {
|
|
216
|
+
const staged = parseSnapshot(value, hostDt, materials);
|
|
217
|
+
try {
|
|
218
|
+
validateBodyBindings(staged.values(), context, world);
|
|
219
|
+
}
|
|
220
|
+
finally {
|
|
221
|
+
disposeEntries(staged);
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
restore(value) {
|
|
225
|
+
alive();
|
|
226
|
+
const staged = parseSnapshot(value, hostDt, materials);
|
|
227
|
+
try {
|
|
228
|
+
validateBodyBindings(staged.values(), context);
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
disposeEntries(staged);
|
|
232
|
+
throw error;
|
|
233
|
+
}
|
|
234
|
+
disposeEntries(entries);
|
|
235
|
+
entries = staged;
|
|
236
|
+
},
|
|
204
237
|
dispose() { if (disposed)
|
|
205
238
|
return; disposed = true; disposeEntries(entries); },
|
|
206
239
|
};
|