@bendyline/molen-entities 0.0.1
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/LICENSE +21 -0
- package/README.md +76 -0
- package/dist/index.d.mts +23 -0
- package/dist/index.mjs +58 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bendyline LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# @bendyline/molen-entities
|
|
2
|
+
|
|
3
|
+
Ids and helpers for Molen's curated entity collection: trees, a shrub and a boulder, the P-51D and
|
|
4
|
+
OH-6 aircraft, and five road vehicles. The models and type documents themselves are content, not
|
|
5
|
+
code: they ship as the `molen.entities` content pack.
|
|
6
|
+
|
|
7
|
+
Part of [Molen](https://molen.dev), an AI-legible 3D experience engine: a deterministic headless
|
|
8
|
+
kernel, a three.js client, and a dev loop an agent can drive end to end.
|
|
9
|
+
|
|
10
|
+

|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm i @bendyline/molen-entities @bendyline/molen-pack
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Node >= 22.13, ESM only, one `.` export. The package itself is a few kilobytes of ids and
|
|
19
|
+
functions; load the `molen.entities` pack from wherever your app hosts it with
|
|
20
|
+
`@bendyline/molen-pack`.
|
|
21
|
+
|
|
22
|
+
## Use
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { createClient } from '@bendyline/molen-client';
|
|
26
|
+
import { createTypeLibrary } from '@bendyline/molen-kernel/content';
|
|
27
|
+
import { molenAircraft } from '@bendyline/molen-entities';
|
|
28
|
+
import { createPackSet, openPack } from '@bendyline/molen-pack';
|
|
29
|
+
|
|
30
|
+
const entities = await openPack('/packs/molen.entities.zip'); // wherever your app hosts it
|
|
31
|
+
|
|
32
|
+
// Models: the pack serves them to the client by asset id.
|
|
33
|
+
const client = await createClient(link, {
|
|
34
|
+
assets: { provider: createPackSet([entities]).assetProvider() },
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Types: the pack's type documents as a library.
|
|
38
|
+
const types = createTypeLibrary(
|
|
39
|
+
await Promise.all((entities.manifest.provides.types ?? []).map((p) => entities.readJson(p))),
|
|
40
|
+
);
|
|
41
|
+
const mustang = molenAircraft(types, 'molen.entities.aircraft.p51d').spec;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The renderable refs and type ids are identical, for example `molen.entities.tree.conifer.pine`. In
|
|
45
|
+
a project, list the pack in `project.json` `packs` and scenes can use the types by id. Each model is
|
|
46
|
+
a deterministic glTF with a `molen/asset@1` sidecar (bounds and collision hull): Y-up,
|
|
47
|
+
meter-scaled, rooted at ground level.
|
|
48
|
+
|
|
49
|
+
## What's in it
|
|
50
|
+
|
|
51
|
+
| Export | For |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| `MOLEN_ENTITY_IDS`, `MolenEntityId` | Every id in the pack |
|
|
54
|
+
| `MOLEN_AIRCRAFT_ENTITY_IDS`, `MOLEN_VEHICLE_ENTITY_IDS` | The aircraft and vehicle ids, with typed unions |
|
|
55
|
+
| `molenAircraft(types, id)`, `molenVehicle(types, id)` | Resolved `aircraft` and `vehicle` component data from a type library |
|
|
56
|
+
| `createMolenEntitiesAssetIndex(baseUrl)` | A client `assets.index` for the pack's files extracted to a static directory (`molen pack extract`) |
|
|
57
|
+
|
|
58
|
+
## Status
|
|
59
|
+
|
|
60
|
+
0.x, on one fixed version line with every other `@bendyline/molen-*` package. The pack's version
|
|
61
|
+
moves separately; entity ids are stable.
|
|
62
|
+
|
|
63
|
+
The aircraft depict real types by their public designations (P-51D Mustang, OH-6) as original
|
|
64
|
+
low-poly models; the pack's NOTICE carries the trademark statement.
|
|
65
|
+
|
|
66
|
+

|
|
67
|
+
|
|
68
|
+
## Docs
|
|
69
|
+
|
|
70
|
+
- [Reusable entities](https://molen.dev/guide/entities): binding the pack, and how the sources are
|
|
71
|
+
authored and regenerated in the repository
|
|
72
|
+
- [Aircraft](https://molen.dev/guide/aircraft): controls, flight physics and cockpit instruments
|
|
73
|
+
- [Mountable vehicles](https://molen.dev/guide/vehicles)
|
|
74
|
+
- [Projects and content packs](https://molen.dev/guide/project)
|
|
75
|
+
|
|
76
|
+
MIT © Bendyline LLC
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TypeLibrary } from "@bendyline/molen-kernel/content";
|
|
2
|
+
import { AircraftData, VehicleData } from "@bendyline/molen-schema";
|
|
3
|
+
|
|
4
|
+
//#region src/index.d.ts
|
|
5
|
+
declare const MOLEN_AIRCRAFT_ENTITY_IDS: readonly ["molen.entities.aircraft.p51d", "molen.entities.aircraft.oh6"];
|
|
6
|
+
declare const MOLEN_VEHICLE_ENTITY_IDS: readonly ["molen.entities.vehicle.compact", "molen.entities.vehicle.sedan", "molen.entities.vehicle.suv", "molen.entities.vehicle.pickup", "molen.entities.vehicle.van"];
|
|
7
|
+
type MolenAircraftEntityId = (typeof MOLEN_AIRCRAFT_ENTITY_IDS)[number];
|
|
8
|
+
type MolenVehicleEntityId = (typeof MOLEN_VEHICLE_ENTITY_IDS)[number];
|
|
9
|
+
/** Stable asset/type ids of the `molen.entities` content pack. */
|
|
10
|
+
declare const MOLEN_ENTITY_IDS: readonly ["molen.entities.tree.conifer.pine", "molen.entities.tree.conifer.fir", "molen.entities.tree.deciduous.oak", "molen.entities.tree.deciduous.birch", "molen.entities.vegetation.shrub", "molen.entities.nature.boulder", "molen.entities.aircraft.p51d", "molen.entities.aircraft.oh6", "molen.entities.vehicle.compact", "molen.entities.vehicle.sedan", "molen.entities.vehicle.suv", "molen.entities.vehicle.pickup", "molen.entities.vehicle.van"];
|
|
11
|
+
type MolenEntityId = (typeof MOLEN_ENTITY_IDS)[number];
|
|
12
|
+
/** Resolved aircraft data for one of the pack's aircraft, from a type library holding it. */
|
|
13
|
+
declare function molenAircraft(types: TypeLibrary, id: MolenAircraftEntityId): AircraftData;
|
|
14
|
+
/** Resolved vehicle data for one of the pack's vehicles, from a type library holding it. */
|
|
15
|
+
declare function molenVehicle(types: TypeLibrary, id: MolenVehicleEntityId): VehicleData;
|
|
16
|
+
/**
|
|
17
|
+
* Build the molen client `assets.index` mapping for this library from a directory holding the
|
|
18
|
+
* `molen.entities` content pack's files (`molen pack extract`), served as static files. This
|
|
19
|
+
* package ships no models; with the pack itself, use its asset provider instead.
|
|
20
|
+
*/
|
|
21
|
+
declare function createMolenEntitiesAssetIndex(baseUrl: string | URL): Record<MolenEntityId, string>;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { MOLEN_AIRCRAFT_ENTITY_IDS, MOLEN_ENTITY_IDS, MOLEN_VEHICLE_ENTITY_IDS, MolenAircraftEntityId, MolenEntityId, MolenVehicleEntityId, createMolenEntitiesAssetIndex, molenAircraft, molenVehicle };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//#region src/index.ts
|
|
2
|
+
const MOLEN_AIRCRAFT_ENTITY_IDS = ["molen.entities.aircraft.p51d", "molen.entities.aircraft.oh6"];
|
|
3
|
+
const MOLEN_VEHICLE_ENTITY_IDS = [
|
|
4
|
+
"molen.entities.vehicle.compact",
|
|
5
|
+
"molen.entities.vehicle.sedan",
|
|
6
|
+
"molen.entities.vehicle.suv",
|
|
7
|
+
"molen.entities.vehicle.pickup",
|
|
8
|
+
"molen.entities.vehicle.van"
|
|
9
|
+
];
|
|
10
|
+
/** Stable asset/type ids of the `molen.entities` content pack. */
|
|
11
|
+
const MOLEN_ENTITY_IDS = [
|
|
12
|
+
"molen.entities.tree.conifer.pine",
|
|
13
|
+
"molen.entities.tree.conifer.fir",
|
|
14
|
+
"molen.entities.tree.deciduous.oak",
|
|
15
|
+
"molen.entities.tree.deciduous.birch",
|
|
16
|
+
"molen.entities.vegetation.shrub",
|
|
17
|
+
"molen.entities.nature.boulder",
|
|
18
|
+
"molen.entities.aircraft.p51d",
|
|
19
|
+
"molen.entities.aircraft.oh6",
|
|
20
|
+
"molen.entities.vehicle.compact",
|
|
21
|
+
"molen.entities.vehicle.sedan",
|
|
22
|
+
"molen.entities.vehicle.suv",
|
|
23
|
+
"molen.entities.vehicle.pickup",
|
|
24
|
+
"molen.entities.vehicle.van"
|
|
25
|
+
];
|
|
26
|
+
const MODEL_PATHS = {
|
|
27
|
+
"molen.entities.tree.conifer.pine": "assets/tree/conifer/pine/model.glb",
|
|
28
|
+
"molen.entities.tree.conifer.fir": "assets/tree/conifer/fir/model.glb",
|
|
29
|
+
"molen.entities.tree.deciduous.oak": "assets/tree/deciduous/oak/model.glb",
|
|
30
|
+
"molen.entities.tree.deciduous.birch": "assets/tree/deciduous/birch/model.glb",
|
|
31
|
+
"molen.entities.vegetation.shrub": "assets/vegetation/shrub/model.glb",
|
|
32
|
+
"molen.entities.nature.boulder": "assets/nature/boulder/model.glb",
|
|
33
|
+
"molen.entities.aircraft.p51d": "assets/molen/entities/aircraft/p51d/model.glb",
|
|
34
|
+
"molen.entities.aircraft.oh6": "assets/molen/entities/aircraft/oh6/model.glb",
|
|
35
|
+
"molen.entities.vehicle.compact": "assets/molen/entities/vehicle/compact/model.glb",
|
|
36
|
+
"molen.entities.vehicle.sedan": "assets/molen/entities/vehicle/sedan/model.glb",
|
|
37
|
+
"molen.entities.vehicle.suv": "assets/molen/entities/vehicle/suv/model.glb",
|
|
38
|
+
"molen.entities.vehicle.pickup": "assets/molen/entities/vehicle/pickup/model.glb",
|
|
39
|
+
"molen.entities.vehicle.van": "assets/molen/entities/vehicle/van/model.glb"
|
|
40
|
+
};
|
|
41
|
+
/** Resolved aircraft data for one of the pack's aircraft, from a type library holding it. */
|
|
42
|
+
function molenAircraft(types, id) {
|
|
43
|
+
return types.component(id, "aircraft");
|
|
44
|
+
}
|
|
45
|
+
/** Resolved vehicle data for one of the pack's vehicles, from a type library holding it. */
|
|
46
|
+
function molenVehicle(types, id) {
|
|
47
|
+
return types.component(id, "vehicle");
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Build the molen client `assets.index` mapping for this library from a directory holding the
|
|
51
|
+
* `molen.entities` content pack's files (`molen pack extract`), served as static files. This
|
|
52
|
+
* package ships no models; with the pack itself, use its asset provider instead.
|
|
53
|
+
*/
|
|
54
|
+
function createMolenEntitiesAssetIndex(baseUrl) {
|
|
55
|
+
return Object.fromEntries(MOLEN_ENTITY_IDS.map((id) => [id, new URL(MODEL_PATHS[id], baseUrl).href]));
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { MOLEN_AIRCRAFT_ENTITY_IDS, MOLEN_ENTITY_IDS, MOLEN_VEHICLE_ENTITY_IDS, createMolenEntitiesAssetIndex, molenAircraft, molenVehicle };
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bendyline/molen-entities",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=22.13.0"
|
|
11
|
+
},
|
|
12
|
+
"description": "Molen entity library: ids and helpers for the molen.entities content pack (trees, rocks, aircraft, vehicles)",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/bendyline/molen.git",
|
|
17
|
+
"directory": "packages/entities"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/bendyline/molen/tree/main/packages/entities",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/bendyline/molen/issues"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"molen",
|
|
25
|
+
"3d",
|
|
26
|
+
"gltf",
|
|
27
|
+
"assets",
|
|
28
|
+
"entity-library"
|
|
29
|
+
],
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.mts",
|
|
33
|
+
"default": "./dist/index.mjs"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist"
|
|
38
|
+
],
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@bendyline/molen-kernel": "0.0.1",
|
|
41
|
+
"@bendyline/molen-schema": "0.0.1"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@biomejs/biome": "^2.5.0",
|
|
45
|
+
"three": "0.184.0",
|
|
46
|
+
"tsdown": "^0.22.2",
|
|
47
|
+
"typescript": "^6.0.3",
|
|
48
|
+
"vitest": "^4.1.8",
|
|
49
|
+
"@bendyline/molen-pack": "0.0.1"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"generate": "node scripts/generate-models.mjs",
|
|
53
|
+
"build": "tsdown && node scripts/generate-models.mjs --check",
|
|
54
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
55
|
+
"lint": "biome check src scripts test package.json",
|
|
56
|
+
"test:unit": "vitest run --passWithNoTests"
|
|
57
|
+
}
|
|
58
|
+
}
|