Diorama

Made for a big screen.

This site is one 3D scene, built for a computer: a wide window and a mouse. Open dioramajs.dev on a desktop or a laptop to see it.This site is one 3D scene, built for a wide window. Make this one wider, or open dioramajs.dev on a larger screen.

GitHub

DioramaDocs

RenderApi interface

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

View as Markdown
import type { RenderApi } from '@dioramajs/diorama/render'
interface RenderApi

Members

NameTypeDescription
readonly backend'webgpu' | 'webgl2'

Backend in use: WebGPU, or WebGL 2 as the fallback.

readonly cameraPerspectiveCamera

Camera that maps CSS px to world units at z = 0.

readonly maxPixelRatioSignal<number>

Upper bound of the pixel ratio, applied at the next frame. Default Infinity.

readonly rendererWebGPURenderer

The three.js renderer.

readonly sceneScene

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.