src/old_threedigitaltwin.js
/**
     * Creates a geometry if the object doesn't have assetType, or uses a model already loaded in a map (modelMesh).
     * Creates a material if the object doesn't have type, or uses a material alreadt loaded in a map (cubeMaterial or materialMesh).
     * 
     * @param {Geometry of an object} object 
     * @param {Boolean that represents if the object has physcis} hasPhysics 
     */
Creates a geometry if the object doesn't have assetType, or uses a model already loaded in a map (modelMesh).
Creates a material if the object doesn't have type, or uses a material alreadt loaded in a map (cubeMaterial or materialMesh).

@param {Geometry of an object} object
@param {Boolean that represents if the object has physcis} hasPhysics
Creates a geometry if the object doesn ' t have assetType or uses a model already loaded in a map ( modelMesh ) . Creates a material if the object doesn ' t have type or uses a material alreadt loaded in a map ( cubeMaterial or materialMesh ) . @param { Geometry of an object } object @param { Boolean that represents if the object has physcis } hasPhysics
loadObject(object, hasPhysics, isVisible) {
        var geometry;
        if (this.modelsMesh.get(object.assetType)) {
            geometry = this.modelsMesh.get(object.assetType).clone();
        } else {
            let boxWidth = object.boxWidth ? object.boxWidth : 5;
            let boxHeight = object.boxHeight ? object.boxHeight : 5;
            let boxDepth = object.boxDepth ? object.boxDepth : 5;
            geometry = new THREE.BoxBufferGeometry(boxWidth, boxHeight, boxDepth);
        }
        var material;
        if (object.textureType == 'regular') {
            material = this.materialsMesh.get(object.type).clone();
        } else if (object.textureType == 'cube') {
            let materialColl = this.cubeMaterial.get(object.type);
            material = [
                materialColl.face1.clone(),
                materialColl.face2.clone(),
                materialColl.face3.clone(),
                materialColl.face4.clone(),
                materialColl.face5.clone(),
                materialColl.face6.clone()];
        }
        else {
            material = new THREE.MeshLambertMaterial({ color: object.textureColor ? object.textureColor : 0xff0000, wireframe: false });
        }
        if (Array.isArray(material)) {
            material.forEach(element => {
                element.polygonOffset = true; 
                element.polygonOffsetFactor = -1; 
                element.polygonOffsetUnits = -1000; 
            });
        } else {
            material.polygonOffset = true; 
            material.polygonOffsetFactor = -1; 
            material.polygonOffsetUnits = -900; 
        }
        return this._loadMesh(object, geometry, material, hasPhysics, isVisible);
    }
loadObject ( object , hasPhysics , isVisible ) { var geometry ; if ( this . modelsMesh . get ( object . assetType ) ) { geometry = this . modelsMesh . get ( object . assetType ) . clone ( ) ; } else { let boxWidth = object . boxWidth ? object . boxWidth : 5 ; let boxHeight = object . boxHeight ? object . boxHeight : 5 ; let boxDepth = object . boxDepth ? object . boxDepth : 5 ; geometry = new THREE . BoxBufferGeometry ( boxWidth , boxHeight , boxDepth ) ; } var material ; if ( object . textureType == 'regular' ) { material = this . materialsMesh . get ( object . type ) . clone ( ) ; } else if ( object . textureType == 'cube' ) { let materialColl = this . cubeMaterial . get ( object . type ) ; material = [ materialColl . face1 . clone ( ) , materialColl . face2 . clone ( ) , materialColl . face3 . clone ( ) , materialColl . face4 . clone ( ) , materialColl . face5 . clone ( ) , materialColl . face6 . clone ( ) ] ; } else { material = new THREE . MeshLambertMaterial ( { color : object . textureColor ? object . textureColor : 0xff0000 , wireframe : false } ) ; } if ( Array . isArray ( material ) ) { material . forEach ( element => { element . polygonOffset = true ; element . polygonOffsetFactor = - 1 ; element . polygonOffsetUnits = - 1000 ; } ) ; } else { material . polygonOffset = true ; material . polygonOffsetFactor = - 1 ; material . polygonOffsetUnits = - 900 ; } return this . _loadMesh ( object , geometry , material , hasPhysics , isVisible ) ; }
Creates a geometry if the object doesn't have assetType, or uses a model already loaded in a map (modelMesh).
Creates a geometry if the object doesn ' t have assetType or uses a model already loaded in a map ( modelMesh ) .
//First, load up the object's geometry /**
             * This is being used ONLY when models are not found in the "modelsMesh" map.
             * It creates a performant BoxBufferGeometry box with the specified default dimensions (5,5,5) or some send by param
            */ //...then, load up its material: //now, if this a 6-faced texture, clone all of its faces individually... // material = new THREE.MeshLambertMaterial({ color: object.textureColor ? object.textureColor : 0xff0000, wireframe: false }); //  element.depthWrite = false; // fix overlapping problems // fix overlapping problems // fix overlapping problems //   element.DoubleSide = true; //   material.depthWrite = false; // fix overlapping problems // fix overlapping problems // fix overlapping problems // material.DoubleSide = true;