# RenderApi

interface in `@dioramajs/diorama/render`

```ts
import type { RenderApi } from '@dioramajs/diorama/render'
```

The `render` service: the three.js renderer, scene and camera.

```ts
interface RenderApi
```

## Members

| Name | Type | Description |
| --- | --- | --- |
| `backend` | `'webgpu' \| 'webgl2'` | Backend in use: WebGPU, or WebGL 2 as the fallback. |
| `camera` | `PerspectiveCamera` | Camera that maps CSS px to world units at z = 0. |
| `maxPixelRatio` | `Signal<number>` | Upper bound of the pixel ratio, applied at the next frame. Default Infinity. |
| `renderer` | `WebGPURenderer` | The three.js renderer. |
| `scene` | `Scene` | The scene GL copies live in. |
| `environment` | `environment(): EnvironmentLease` | A lease on `scene.environment`: the first creates it, the last frees it. Ready at once with `environment: 'none'`. |
| `place` | `place(object: Object3D, box: Box): void` | Fits a unit-sized object, centred at its origin, onto a viewport box. |
| `toWorld` | `toWorld(x: number, y: number, out?: { x: number; y: number }): { x: number; y: number }` | Converts a viewport point in CSS px to world x/y on the z = 0 plane. Fills `out` if given. |

Also exported from `@dioramajs/render`.

Defined in [packages/render/src/index.ts](https://github.com/MasterKurosava/diorama/blob/main/packages/render/src/index.ts#L93).
