// THREE.js instantiation _createTHREENodes() { this.totalContent = new THREE.Group(); // Three JS Object3D Group for this tile and all its children this.tileContent = new THREE.Group(); // Three JS Object3D Group for this tile's content this.childContent = new THREE.Group(); // Three JS Object3D Group for this tile's children this.totalContent.add(this.tileContent); this.totalContent.add(this.childContent); }
_initTraversal(json, parentRefine, isRoot) { this.refine = json.refine ? json.refine.toUpperCase() : parentRefine; this.geometricError = json.geometricError; this.transform = json.transform; if (this.transform && !isRoot) { // if not the root tile: apply the transform to the THREE js Group // the root tile transform is applied to the camera while rendering this.totalContent.applyMatrix(new THREE.Matrix4().fromArray(this.transform)); } this.content = json.content; this.children = []; if (json.children) { for (let i = 0; i < json.children.length; i++) { const child = new TileHeader( json.children[i], this.resourcePath, this.styleParams, this.refine, false ); this.childContent.add(child.totalContent); this.children.push(child); } } }
// eslint-disable-next-line max-statements constructor(json, resourcePath, styleParams, parentRefine, isRoot) { this.loaded = false; this.styleParams = styleParams; this.resourcePath = resourcePath; this.debug = DEBUG; this.extent = null; this.sw = null; this.ne = null; this.box = null; this.center = null; this._createTHREENodes(); this.boundingVolume = json.boundingVolume; const box = this.boundingVolume && this.boundingVolume.box; if (box) { this.box = createTHREEBoxFromOBB(box); if (DEBUG) { this.totalContent.add(createTHREEOutlineFromOBB(box)); } } this._initTraversal(json, parentRefine, isRoot); }
); this.childContent.add(tileset.root.totalContent);
group.add(meshes[i]);
group.add(meshes[i]);