Skip to content

Commit

Permalink
refactor(PlanarLayer): homogeneisation with GlobeLayer in args
Browse files Browse the repository at this point in the history
  • Loading branch information
ftoromanoff committed Jul 4, 2024
1 parent 0704c2c commit c638d11
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/Core/Prefab/Planar/PlanarLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class PlanarLayer extends TiledGeometryLayer {
* @param {string} id - The id of the layer, that should be unique. It is
* not mandatory, but an error will be emitted if this layer is added a
* {@link View} that already has a layer going by that id.
* @param {Extent} extent - The extent to define the layer within.
* @param {THREE.Object3d} [object3d=THREE.Group] - The object3d used to
* contain the geometry of the TiledGeometryLayer. It is usually a
* `THREE.Group`, but it can be anything inheriting from a `THREE.Object3d`.
Expand All @@ -30,14 +29,16 @@ class PlanarLayer extends TiledGeometryLayer {
* contains three elements `name, protocol, extent`, these elements will be
* available using `layer.name` or something else depending on the property
* name.
* @param {Extent} config.extent - The extent to define the layer within.
* @param {number} [config.maxSubdivisionLevel=5] - Maximum subdivision
* level for this tiled layer.
* @param {number} [config.maxDeltaElevationLevel=4] - Maximum delta between
* two elevations tile.
*
* @throws {Error} `object3d` must be a valid `THREE.Object3d`.
*/
constructor(id, extent, object3d, config = {}) {
constructor(id, object3d, config = {}) {
const extent = config.extent;
const tms = CRS.formatToTms(extent.crs);

const scheme = schemeTiles.get(tms);
Expand Down
11 changes: 7 additions & 4 deletions src/Core/Prefab/PlanarView.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import View from 'Core/View';
import CameraUtils from 'Utils/CameraUtils';

import PlanarControls from 'Controls/PlanarControls';
import PlanarLayer from './Planar/PlanarLayer';
import PlanarLayer from 'Core/Prefab/Planar/PlanarLayer';
import { ellipsoidSizes } from 'Core/Math/Ellipsoid';

class PlanarView extends View {
/**
Expand Down Expand Up @@ -46,11 +47,13 @@ class PlanarView extends View {
// Configure camera
const dim = extent.planarDimensions();
const max = Math.max(dim.x, dim.y);
this.camera3D.near = 0.1;
this.camera3D.far = this.camera3D.isOrthographicCamera ? 2000 : 2 * max;
// this.camera3D.near = 0.1;
// this.camera3D.far = this.camera3D.isOrthographicCamera ? 2000 : 2 * max;
this.camera3D.near = Math.max(15.0, 0.000002352 * ellipsoidSizes.x);
this.camera3D.far = ellipsoidSizes.x * 10;
this.camera3D.updateProjectionMatrix();

const tileLayer = new PlanarLayer('planar', extent, options.object3d, options);
const tileLayer = new PlanarLayer('planar', options.object3d, options);
this.mainLoop.gfxEngine.label2dRenderer.infoTileLayer = tileLayer.info;

this.addLayer(tileLayer);
Expand Down

0 comments on commit c638d11

Please sign in to comment.