ThreePresenter API Documentation - v0.1.2
    Preparing search index...

    ThreePresenter API Documentation - v0.1.2

    Three Presenter - Modular 3D Viewer Components

    Independent, reusable modules for building 3D viewers with Three.js.

    The library follows a Data-Driven Design pattern, separating state from rendering logic, and uses Dependency Injection for modularity.

    • ThreePresenter: The main controller that orchestrates the 3D scene, manages state, and coordinates other components.
    • SceneDescription: A pure JSON object defining the scene (models, environment), decoupled from the runtime state.

    The functionality is split into specialized managers to avoid a monolithic design:

    • InputController: Handles all user input (mouse, touch, keyboard) and raycasting. It is decoupled from the presenter and communicates via callbacks.
    • DefaultUI: A standalone UI overlay that consumes the presenter's state and methods. It demonstrates how to build a UI on top of the library without tight coupling.
    • RenderLoop: Encapsulates the requestAnimationFrame loop, allowing for efficient rendering control.
    • Managers: Specialized classes for internal logic:

    The ThreePresenter constructor accepts a managers object, allowing you to inject custom implementations of core subsystems (like ModelLoader or LightingManager) for testing or customization.

    // Custom composition
    const presenter = new ThreePresenter({
    mount: 'viewer',
    managers: {
    renderLoop: new CustomRenderLoop()
    }
    });

    Classes

    ThreePresenter
    AnnotationManager
    CameraManager
    InputController
    LightingManager
    ModelLoader
    RenderLoop
    DefaultFileUrlResolver
    StaticBaseUrlResolver
    FunctionResolver
    DefaultUI
    UIControlsBuilder
    ScaleIndicator

    Interfaces

    ThreePresenterConfig
    LoadingProgress
    CameraConfig
    CameraState
    InputControllerConfig
    LightingConfig
    LightingState
    LoaderConfig
    MaterialProperties
    LoadResult
    AnnotationConfig
    FileResolverContext
    FileUrlResolver
    Annotation
    ModelDefinition
    EnvironmentSettings
    SceneDescription
    PresenterState
    DefaultUIConfig
    ButtonConfig
    ContainerConfig
    UIControlsResult
    GeometryStats
    ScaleIndicatorConfig

    Functions

    createCameraManager
    createModelLoader
    createButton
    createButtonPanel
    calculateObjectStats
    calculateSceneBoundingBox
    getMaxDimension
    calculateCameraDistance
    calculateCenteringOffset
    calculateSceneCenteringOffset
    hasValidPosition
    roundPosition
    formatStats
    parseIIIFManifest

    Type Aliases

    ProgressCallback
    SelectionChangeCallback
    PointPickedCallback
    AnnotationType
    AnnotationGeometry