src/core/engines/ogl/ogl.js
/**
     * Add 3D model of format gltf to the scene.
     *
     * @param position  number{x, y, z}        3D position of the placeholder
     * @param orientation  number{x, y, z, w}     Orientation of the placeholder
     * @param url  String       URL to load the model from
     * @returns {Transform}
     */
Add 3D model of format gltf to the scene.
@param position  number{x, y, z}        3D position of the placeholder
@param orientation  number{x, y, z, w}     Orientation of the placeholder
@param url  String       URL to load the model from
@returns {Transform}
Add 3D model of format gltf to the scene . @param position number { x y z } 3D position of the placeholder @param orientation number { x y z w } Orientation of the placeholder @param url String URL to load the model from @returns { Transform }
addModel(position, orientation, url) {
        const gltfScene = new Transform();
        gltfScene.position.set(position.x, position.y, position.z);
        gltfScene.quaternion.set(orientation.x, orientation.y, orientation.z, orientation.w);
        gltfScene.setParent(scene);
        GLTFLoader.load(gl, url)
            .then(gltf => {
                const s = gltf.scene || gltf.scenes[0];
                s.forEach(root => {
                    root.setParent(gltfScene);
                });
            }).catch(() => {
                console.log("Unable to load model from URL: " + url);
                console.log("Adding placeholder box instead");
                let gltfPlaceholder = createAxesBoxPlaceholder(gl, [1.0, 0.0, 0.0, 0.5], false) 
                gltfScene.addChild(gltfPlaceholder);
            });
        scene.updateMatrixWorld();
        return gltfScene;
    }
addModel ( position , orientation , url ) { const gltfScene = new Transform ( ) ; gltfScene . position . set ( position . x , position . y , position . z ) ; gltfScene . quaternion . set ( orientation . x , orientation . y , orientation . z , orientation . w ) ; gltfScene . setParent ( scene ) ; GLTFLoader . load ( gl , url ) . then ( gltf => { const s = gltf . scene || gltf . scenes [ 0 ] ; s . forEach ( root => { root . setParent ( gltfScene ) ; } ) ; } ) . catch ( ( ) => { console . log ( "Unable to load model from URL: " + url ) ; console . log ( "Adding placeholder box instead" ) ; let gltfPlaceholder = createAxesBoxPlaceholder ( gl , [ 1.0 , 0.0 , 0.0 , 0.5 ] , false ) gltfScene . addChild ( gltfPlaceholder ) ; } ) ; scene . updateMatrixWorld ( ) ; return gltfScene ; }
Add 3D model of format gltf to the scene.
Add 3D model of format gltf to the scene .
// red