Skip to main content

Viewer settings

Functions​

parseCameraSettings()​

function parseCameraSettings(input): CameraSettings;

Canonical, finite camera values shared by attributes and URL search parameters.

Parameters​

ParameterType
input{ cameraOrbit?: unknown; cameraTarget?: unknown; fieldOfView?: unknown; }
input.cameraOrbit?unknown
input.cameraTarget?unknown
input.fieldOfView?unknown

Returns​

CameraSettings


normalizeEnvironmentRotation()​

function normalizeEnvironmentRotation(input): number | undefined;

Finite yaw in degrees, wrapped into [0, 360); invalid values are ignored.

Parameters​

ParameterType
inputunknown

Returns​

number | undefined


parseViewerSettings()​

function parseViewerSettings(input, assets?): Partial<ViewerSettings>;

Parameters​

ParameterType
inputRecord<string, unknown>
assets?{ ibls?: readonly string[]; geometries?: readonly string[]; }
assets.ibls?readonly string[]
assets.geometries?readonly string[]

Returns​

Partial<ViewerSettings>

Interfaces​

CameraSettings​

Optional declarative framing. Geometry is normalized to a one-meter cube before framing.

Properties​

PropertyTypeDescription
cameraOrbit?stringAzimuth and polar angle in degrees, then distance in meters: 30deg 65deg 2m.
cameraTarget?stringCamera aim point in normalized scene meters: 0m 0m 0m.
fieldOfView?numberVertical field of view in degrees, between 1 and 120.

RenderingSettings​

Properties​

PropertyType
bloomboolean
aoboolean
toneMapping"neutral" | "aces" | "agx" | "reinhard" | "cineon" | "linear" | "none"

SettingsOption​

Properties​

PropertyType
valuestring
labelstring

Type Aliases​

ToneMappingName​

type ToneMappingName = typeof TONE_MAPPING_OPTIONS[number]["value"];

BackgroundKind​

type BackgroundKind = typeof BACKGROUND_OPTIONS[number]["value"];

AnimationMode​

type AnimationMode = false | "play" | "pause" | undefined;

false hides the play/pause control; 'play'/'pause' set the initial state; undefined plays.


ViewerSettings​

type ViewerSettings = Omit<typeof DEFAULT_VIEWER_SETTINGS, "ibl" | "geometry"> & CameraSettings & object;

Asset names may include host-configured environments and geometries.

Type Declaration​

NameType
iblstring
geometrystring

Variables​

TONE_MAPPING_OPTIONS​

const TONE_MAPPING_OPTIONS: readonly [{
value: "neutral";
label: "Neutral";
}, {
value: "aces";
label: "ACES Filmic";
}, {
value: "agx";
label: "AgX";
}, {
value: "reinhard";
label: "Reinhard";
}, {
value: "cineon";
label: "Cineon";
}, {
value: "linear";
label: "Linear";
}, {
value: "none";
label: "None";
}];

Tone mapping names shared by viewer controls and extension configuration.


DEFAULT_RENDERING_SETTINGS​

const DEFAULT_RENDERING_SETTINGS: RenderingSettings;

GEOMETRY_OPTIONS​

const GEOMETRY_OPTIONS: SettingsOption[];

IBL_OPTIONS​

const IBL_OPTIONS: SettingsOption[];

BACKGROUND_OPTIONS​

const BACKGROUND_OPTIONS: readonly [{
value: "white";
label: "White";
}, {
value: "environment";
label: "Environment";
}, {
value: "none";
label: "None";
}];

none lights the scene with the IBL but leaves the backdrop transparent (clear alpha 0).


DEFAULT_VIEWER_SETTINGS​

const DEFAULT_VIEWER_SETTINGS: object;

Type Declaration​

NameTypeDefault value
bloomboolean-
aoboolean-
toneMapping"neutral" | "aces" | "agx" | "reinhard" | "cineon" | "linear" | "none"-
ibl"studio" | "bridge"-
background"none" | "white" | "environment"-
intensitynumber1
environmentRotationnumber0
exposurenumber0
rotatebooleanfalse
materialNamestring''
geometry"totem" | "sphere" | "cube" | "plane"-