# @ferret/fmdl-import: API

14 exports. Generated from the source (`packages/fmdl-import/src`), so it matches the code.

## Functions

### carModelFiles

*function* · `packages/fmdl-import/src/destruction.ts:24`

```ts
async function carModelFiles(o: CarModelOptions): Promise<Map<string, Uint8Array>>
```

### carNodes

*function* · `packages/fmdl-import/src/destruction.ts:11`

```ts
function carNodes(glb: Uint8Array): NodeInfo[]
```

the nodes of a car glb as autoparts reads them: bounds in the car frame (x forward, y up, z across, the origin on the ground) and the place of each node's origin (a wheel's hub)

### figureModelFiles

*function* · `packages/fmdl-import/src/humans.ts:17`

```ts
async function figureModelFiles(data: HumanData, spec: HumanSpec, o: FigureModelOptions): Promise<Map<string, Uint8Array>>
```

### gltfModelFiles

*function* · `packages/fmdl-import/src/library.ts:34`

```ts
function gltfModelFiles(spec: ImportSpec): Promise<Map<string, Uint8Array>>
```

A glTF file as a model: the same call with what the importer has to be told (`ferret fmdl import`).

### libraryModelFiles

*function* · `packages/fmdl-import/src/library.ts:16`

```ts
async function libraryModelFiles(o: LibraryModelOptions): Promise<Map<string, Uint8Array>>
```

The item's tiers become the levels (the heaviest tier first, each tier the `maxTier` of its level), its materials' alpha and sidedness the render side, its collision the collision shape.

### physicalOf

*function* · `packages/fmdl-import/src/terrain.ts:7`

```ts
function physicalOf: (name: string) => Record<string, number>
```

### plantModelFiles

*function* · `packages/fmdl-import/src/terrain.ts:43`

```ts
async function plantModelFiles(o: PlantOptions): Promise<Map<string, Uint8Array>>
```

A generated plant: a static body whose collision is the trunk's cylinder (measured from the mesh at its foot) over the whole height.

### rockModelFiles

*function* · `packages/fmdl-import/src/terrain.ts:21`

```ts
async function rockModelFiles(o: RockOptions): Promise<Map<string, Uint8Array>>
```

A generated rock. Its mass is its volume times the density of its material: the generator's mesh is closed, so the volume is exact.

## Interfaces

### CarModelOptions

*interface* · `packages/fmdl-import/src/destruction.ts:15`

```ts
interface CarModelOptions
```

- `id: string`
- `name: string` — the name of the car: its curb weight is in the table of autoparts for the two library cars
- `mass?: number` — kg; needed for a car the table does not know
- `levels: { glb: Uint8Array; maxTier?: ModelTier }[]` — the glb of each level, the best first
- `summary?: string`
- `materials?: Record<string, string | Record<string, number>>`

### FigureModelOptions

*interface* · `packages/fmdl-import/src/humans.ts:6`

```ts
interface FigureModelOptions
```

- `id: string`
- `mass: number` — kg: the body spec holds the height and the age, not the weight, so the caller gives it
- `tiers?: { tier: string; maxTier: ModelTier }[]` — the tiers of the figure to make a level of, the best first; each is the heaviest device tier that may draw it. Default: the full tier for desktop
- `glb?: GlbOptions`

### LibraryModelOptions

*interface* · `packages/fmdl-import/src/library.ts:7`

```ts
interface LibraryModelOptions
```

- `item: ModelItem`
- `read: (file: string) => Uint8Array | Promise<Uint8Array>` — the bytes of a file of the item's package, by its path
- `mass: number` — kg: the library item knows the bounds and the collision, not the weight
- `materials: ImportSpec['materials']` — the physical side of each glTF material of the item, `*` for the rest
- `summary?: string`
- `kind?: string`

### PlantOptions

*interface* · `packages/fmdl-import/src/terrain.ts:36`

```ts
interface PlantOptions
```

- `id: string`
- `shape: string`
- `seed: number`
- `variant?: number`
- `height: number` — the height, m
- `mass: number` — kg: the generator knows the shape, not what a plant of this species weighs, so the caller gives it

### RockOptions

*interface* · `packages/fmdl-import/src/terrain.ts:13`

```ts
interface RockOptions
```

- `id: string`
- `seed: number`
- `variant?: number`
- `angular?: number` — 0..1: how faceted it is (fresh blocks) against rounded
- `detail?: number`
- `size: number` — the largest dimension, m
- `material?: string` — the name of a physical material of the physics table; default stone

## Constants

### BODY_DENSITY

*const* · `packages/fmdl-import/src/humans.ts:15`

```ts
const BODY_DENSITY: 1010
```

The mean density of a human body, kg/m3: the physical side of every material of a person.

