# @ferret/perspective: API (continued)

### Representation

*interface* · `packages/perspective/src/view.ts:20`

```ts
interface Representation
```

Something a rung draws. Meshes implement it here; the impostor implements it in impostor.ts.

- `setState(state: RepState, mix: number): void`
- `setFrame?(f: number): void` — an animated impostor: show frame `f` of the baked loop (a still atlas ignores it)
- `tint?(color: BABYLON.Color3 | null): void` — debug: tint the representation (null: remove the tint)

### ResolvedBake

*interface* · `packages/perspective/src/bake-spec.ts:32`

```ts
interface ResolvedBake
```

- `views: number`
- `cell: number`
- `mode: OctaMode`
- `hide: string[]`
- `replace: Record<string, string>`
- `radius?: number`
- `maps: BakeMap[]`
- `clips: Record<string, number>`
- `flat?: boolean`

### Rgb

*interface* · `packages/perspective/src/compare.ts:6`

```ts
interface Rgb
```

RGB bytes of a w x h image, three per pixel.

- `data: ArrayLike<number>`
- `width: number`
- `height: number`

### SceneLight

*interface* · `packages/perspective/src/points.ts:62`

```ts
interface SceneLight
```

The scene's light as the impostor and point shaders take it: the hemispheric light as an up and a down colour (mixed by the normal), the directional lights summed as one sun.

- `ambient: Point3` — the mean of up and down: what a surface of any orientation gets
- `ambientUp: Point3`
- `ambientDown: Point3`
- `sun: Point3`
- `toSun: Point3`

### Sphere

*interface* · `packages/perspective/src/projection.ts:57`

```ts
interface Sphere
```

A bounding sphere in world space.

- `centre: Point3`
- `radius: number`

### ViewBlend

*interface* · `packages/perspective/src/octa.ts:38`

```ts
interface ViewBlend
```

- `views: [[number, number], [number, number], [number, number]]` — three views of the grid, each [i, j]
- `weights: [number, number, number]` — their weights; they sum to 1

## Types

### BakeMap

*type* · `packages/perspective/src/bake-spec.ts:9`

```ts
type BakeMap = 'color' | 'normal' | 'orm'
```

### LevelKind

*type* · `packages/perspective/src/select.ts:4`

```ts
type LevelKind = 'full' | 'mesh' | 'impostor' | 'point' | 'none'
```

### OctaMode

*type* · `packages/perspective/src/octa.ts:5`

```ts
type OctaMode = 'sphere' | 'hemisphere'
```

### Point3

*type* · `packages/perspective/src/projection.ts:4`

```ts
type Point3 = [number, number, number]
```

### Recorded

*type* · `packages/perspective/src/backend.ts:47`

```ts
type Recorded = | { call: 'apply'; id: string; from: number; to: number; mix: number } | { call: 'points'; ids: string[] }
```

What a backend call was, for tests.

### RepState

*type* · `packages/perspective/src/view.ts:17`

```ts
type RepState = 'off' | 'on' | 'in' | 'out'
```

How a rung is shown: fully (`on`), fading in, fading out (with the mix 0..1 of the cross-fade), or not at all.

### Variant

*type* · `packages/perspective/src/measure.ts:42`

```ts
type Variant = 'full' | 'mesh' | 'impostor' | 'point' | 'none'
```

## Constants

### AMBIENT_SCALE

*const* · `packages/perspective/src/points.ts:100`

```ts
const AMBIENT_SCALE: 1
```

What a Babylon PBR surface (no environment map) returns of the light it gets, measured on a flat plate of known albedo under each light alone
(tools/perspective/check, calibration of 2026-11-10): the hemispheric light comes back whole (albedo x light), the directional light as albedo x light x
cos / 3 (the Lambert 1/pi, 0.347 measured); the two add.

### BAKE_VERSION

*const* · `packages/perspective/src/bake-spec.ts:7`

```ts
const BAKE_VERSION: 2
```

Bumped when the bake or the atlas format changes: older atlases are then baked again.

### SUN_SCALE

*const* · `packages/perspective/src/points.ts:101`

```ts
const SUN_SCALE: 0.347
```

### VISIBLE_CONTRAST

*const* · `packages/perspective/src/measure.ts:45`

```ts
const VISIBLE_CONTRAST: 4
```

How visible an object has to be for an error in it to count: the object's contrast, in pixels of sky brightness (a black object of 4 px of area has 4).

