createInstance(linkedObject) {
        var id = this._idCounter++;

        // update the index
        this._idToIndex[id] = this._entries.length;

        var entry = {
            matrix: linkedObject? null : new Matrix4(),
            link: linkedObject,
            id: id,
            bounds: this.geometry.boundingBox.clone(),
            originalUpdateMatrixWorld: null
        };
        this._entries.push(entry);

        var geometry = this.geometry;

        if (linkedObject) {
            entry.originalUpdateMatrixWorld = linkedObject._updateMatrixWorld;
            linkedObject._updateMatrixWorld = function()
            {
                entry.originalUpdateMatrixWorld.call(this);
                entry.bounds.copy(geometry.boundingBox).applyMatrix4(this._matrixWorld);
            }
        }

        this.geometry.addInstance();
        return id;
    }
// linkedObject is optional, it's there to link a scene graph object directly to an instance, removing the need for setMatrix
linkedObject is optional, it's there to link a scene graph object directly to an instance, removing the need for setMatrix
linkedObject is optional it ' s there to link a scene graph object directly to an instance removing the need for setMatrix
createInstance(linkedObject) {
        var id = this._idCounter++;
        this._idToIndex[id] = this._entries.length;
        var entry = {
            matrix: linkedObject? null : new Matrix4(),
            link: linkedObject,
            id: id,
            bounds: this.geometry.boundingBox.clone(),
            originalUpdateMatrixWorld: null
        };
        this._entries.push(entry);
        var geometry = this.geometry;
        if (linkedObject) {
            entry.originalUpdateMatrixWorld = linkedObject._updateMatrixWorld;
            linkedObject._updateMatrixWorld = function()
            {
                entry.originalUpdateMatrixWorld.call(this);
                entry.bounds.copy(geometry.boundingBox).applyMatrix4(this._matrixWorld);
            }
        }
        this.geometry.addInstance();
        return id;
    }
createInstance ( linkedObject ) { var id = this . _idCounter ++ ; this . _idToIndex [ id ] = this . _entries . length ; var entry = { matrix : linkedObject ? null : new Matrix4 ( ) , link : linkedObject , id : id , bounds : this . geometry . boundingBox . clone ( ) , originalUpdateMatrixWorld : null } ; this . _entries . push ( entry ) ; var geometry = this . geometry ; if ( linkedObject ) { entry . originalUpdateMatrixWorld = linkedObject . _updateMatrixWorld ; linkedObject . _updateMatrixWorld = function ( ) { entry . originalUpdateMatrixWorld . call ( this ) ; entry . bounds . copy ( geometry . boundingBox ) . applyMatrix4 ( this . _matrixWorld ) ; } } this . geometry . addInstance ( ) ; return id ; }
linkedObject is optional, it's there to link a scene graph object directly to an instance, removing the need for setMatrix
linkedObject is optional it ' s there to link a scene graph object directly to an instance removing the need for setMatrix
// update the index