View Options

Below we will consider view options as an optional parameter for the function c3dinstance.createView(..).

Object type of view options (TypeScript):

export type CreateViewOptions = {
    uuid?: string,
    callbacksList?: events.C3DModelViewEvents
    monitoring?: {
        frame?: {
            time: number
            fps: number
            nDrawCalls: number
            nDrawTriangles: number
            nDrawLines: number
        }
        scene?:{
            segments?: number
        }
    }
}

Let’s consider the meaning of all the properties in the view options.

Property ‘UUID’

This property allows you to connect to a selected workspace. It contains a specified group of models in a scene. If the workspace with such a UUID doesn’t exist, then it will be created. UUID is always generated randomly by default.

Property ‘Callbacks’

Available callbacks (TypeScript):

{
    /**
     * A model is added to a workspace
     */
    onAddModel?: (uuid:string)=>void
    // 
    /**
     * A model is removed from a workspace
     */
    onRemoveModel?: (uuid:string)=>void
    /**
     *  One of workspace models is loaded
     * */ 
    onCompletedModel?: (uuid:string)=>void
    /**
     * The model is fully shown on scene
     */
    onFullLoadedModel?:(uuid: string) => void
    /**
     * A workspace is cleaned out
     */
    onClear?: ()=>void

    /**
     * A node of a model is added
     */
    onAddNode?:(uuid:string)=>void
    /**
     * A node of a model is removed
     */
    onRemoveNode?:(uuid:string)=>void

    /**
     * An element of a model is picked
     */
    onPickElement?:(uuid:string)=>void
}

Example of onCompletedModel and onFullLoadedModel callbacks calling. If two models are loaded at the same time, the both callbacks will be called twice for every model, but the first will be called at a structure loading completion and the second will be called after a geometries loading. Also onFullLoadedModel will call only after all model geometry are displayed. It’s useful in the case, for example, when you put a ‘slasher’ on loading (onCompletedModel for fixing exist a model UUID and onFullLoadedModel for release a model UUID). But it can never run if the entire model isn’t shown fully at the start (zoomed to some part).

Property ‘Monitoring’

This property contains an object with properties which update while the C3D Vision is running.