V3DScene is used by View-in-3D viewer

Hierarchy (view full)

Constructors

  • Instantiate a new V3DScene

    Parameters

    • canvas: Nullable<HTMLCanvasElement>

      defines the canvas to use for rendering. If NullEngine is used, set the canvas as null.

    • presetConfig: Config = V3D_CONFIG

      pre-defined configuration. By default, use V3D_CONFIG.

    • configOverride: Config = {}

      used to override parameters in pre-defined configuration

    Returns V3DScene

Properties

_canvas: Nullable<HTMLCanvasElement>
_engine: Engine
_filesInput: Nullable<FilesInput>
_initialConfig: Config
_modelLoader: ModelLoader
_observableManager: ObservableManager
_sceneManager: SceneManager

Accessors

  • get canvas(): Nullable<HTMLCanvasElement>
  • Define the canvas to use for rendering

    Returns Nullable<HTMLCanvasElement>

  • get engine(): Engine
  • The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio

    Returns Engine

  • get filesInput(): Nullable<FilesInput>
  • Class used to help managing file picking and drag-n-drop

    Returns Nullable<FilesInput>

  • get scene(): Scene
  • Represent a scene to be rendered by the engine

    Returns Scene

Methods

  • Gets a camera using its name

    Parameters

    • cameraName: string

      defines the camera's name

    Returns Nullable<Camera>

    the camera or null if none found.

  • Asynchronously import a glTF or glb file into the scene. Either a URL path to the file must be provided, or the base64 based string of a glb file (starts with 'data:').

    Parameters

    • url: string

      URL path to the glTF or glb file, or base64 based string (starts with 'data:')

    • OptionaldisableAnimation: boolean

      whether disable animation of the loaded model (default: false)

    • OptionalmodelName: string

      the name of model

    • Optionaloptions: LoadGltfOptions

      optional config

    Returns Promise<Model>

    A promise of Model

    Error if no glTF content or url provided

  • Import a glTF or glb model from files into the scene.

    Notes: The loaded model can be found: 1) in AbstractScene.sceneManager.models map 2) by adding an observer to AbstractScene.observableManager.onModelLoadedObservable

    Parameters

    • files: File[]

      A list of files, which can be a GLB file or a GLTF file along with multiple texture files and bin files

    Returns void

  • Register a new action to be preformed after a gltf/glb scene file has been loaded

    Parameters

    • action: ((scene: Scene) => void)

      a function which takes a scene as input and preforms some process after it has been loaded then returns void

        • (scene): void
        • Parameters

          • scene: Scene

          Returns void

    Returns void

  • Register a callback that will be invoked after camera first interaction

    Parameters

    • callback: (() => void)

      will be invoked after camera first interaction

        • (): void
        • Returns void

    Returns void

  • Capture a screenshot of the current rendering

    Parameters

    • size: number | IScreenshotSize

      This parameter can be set to a single number or to an object with the following (optional) properties: precision, width, height. If a single number is passed, it will be used for both width and height. If an object is passed, the screenshot size will be derived from the parameters. The precision property is a multiplier allowing rendering at a higher or lower resolution

    • usingRenderTarget: boolean = false

      whether to use CreateScreenshotUsingRenderTarget function. Default: false

    Returns Promise<string>

    base64 encoded string

  • Asynchronously update the scene's configuration, including camera, lights, environment, etc.

    Parameters

    • newConfig: Partial<Config>

      the delta that should be configured. This includes only the changes.

    Returns Promise<void>

  • Adjust camara zoom-in level on models. Only works for ArcRotateCamera with FramingBehavior enabled. FramingBehavior must be configured before loading models.

    Parameters

    • models: Model[]

      A list of models used to determine camera zoom-in level

    Returns void