forked from iTowns/itowns
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move geometric layers off views
Move all contents of `createXXXLayer` in XXXView to XXXLayer in Prefab/XXX/. This declutters the XXXView files. This change applies for Globe, Planar and Panorama. In the same time, GeometryLayer has been extract from Layer and given some new methods which were repeated through each View.
- Loading branch information
Showing
27 changed files
with
718 additions
and
704 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import * as THREE from 'three'; | ||
|
||
import TiledGeometryLayer from '../../../Layer/TiledGeometryLayer'; | ||
|
||
import { processTiledGeometryNode } from '../../../Process/TiledNodeProcessing'; | ||
import { globeCulling, preGlobeUpdate, globeSubdivisionControl, globeSchemeTileWMTS, globeSchemeTile1 } from '../../../Process/GlobeTileProcessing'; | ||
import BuilderEllipsoidTile from './BuilderEllipsoidTile'; | ||
import Picking from '../../Picking'; | ||
|
||
class GlobeLayer extends TiledGeometryLayer { | ||
/** | ||
* A geometry layer to be used only with a {@link GlobeView}. | ||
* | ||
* @constructor | ||
* | ||
* @param {Object} config | ||
* @param {THREE.Object3D} config.object3d | ||
* @param {number} [config.maxSubdivisionLevel=18] | ||
* @param {number} [config.sseSubdivisionThreshold=1] | ||
* @param {number} [config.maxDeltaElevationLevel=4] | ||
*/ | ||
constructor(config) { | ||
super(config, config.object3d || new THREE.Group()); | ||
|
||
// Configure tiles | ||
this.schemeTile = globeSchemeTileWMTS(globeSchemeTile1); | ||
this.extent = this.schemeTile[0].clone(); | ||
for (let i = 1; i < this.schemeTile.length; i++) { | ||
this.extent.union(this.schemeTile[i]); | ||
} | ||
|
||
function subdivision(context, layer, node) { | ||
if (TiledGeometryLayer.hasEnoughTexturesToSubdivide(context, node)) { | ||
return globeSubdivisionControl(2, | ||
config.maxSubdivisionLevel || 18, | ||
config.sseSubdivisionThreshold || 1.0, | ||
config.maxDeltaElevationLevel || 4)(context, layer, node); | ||
} | ||
return false; | ||
} | ||
|
||
this.update = processTiledGeometryNode(globeCulling(2), subdivision); | ||
this.builder = new BuilderEllipsoidTile(); | ||
} | ||
|
||
pickObjectsAt(view, mouse, radius = 5) { | ||
return Picking.pickTilesAt(view, mouse, radius, this); | ||
} | ||
|
||
preUpdate(context, changeSources) { | ||
if (__DEBUG__) { | ||
this._latestUpdateStartingLevel = 0; | ||
} | ||
|
||
preGlobeUpdate(context, this); | ||
|
||
return super.preUpdate(context, changeSources); | ||
} | ||
} | ||
|
||
export default GlobeLayer; |
Oops, something went wrong.