On this page

Type Alias CubemapDefinition

CubemapDefinition:
    | {
        color?: string;
        faces?: never;
        path: { baseUrl: string; format?: "png"
        | "jpg"
        | "webp" };
        preset?: never;
    }
    | { color?: string; faces: CubemapFaces; path?: never; preset?: never }
    | {
        color?: string;
        faces?: never;
        path?: never;
        preset: keyof typeof cubemapPresets;
    }
    | { color: string; faces?: never; path?: never; preset?: never }

Defines how a cubemap should be constructed from source materials. This is a discriminated union type with four possible formats:

  1. Path-based: Specify a base URL and optional format for cube face images
  2. Faces-based: Provide explicit URLs for each cube face
  3. Preset-based: Use a predefined cubemap from available presets
  4. Color-based: Use a single color for all faces

Only one of path, faces, preset, or color should be provided.

// Path-based cubemap
const pathCubemap: CubemapDefinition = {
  path: {
    baseUrl: 'https://example.com/cubemap',
    format: 'png'
  }
};

// Color-based cubemap
const colorCubemap: CubemapDefinition = {
  color: '#ff0000'
};
Was this helpful?
SDK JS
Reference
CubemapDefinition