Skip to content

Commit

Permalink
Merge pull request #14 from NASA-AMMOS/ts-2
Browse files Browse the repository at this point in the history
#2 Model Layers
  • Loading branch information
tariqksoliman committed Dec 13, 2021
2 parents 84287c0 + bb251bf commit 1c9c331
Show file tree
Hide file tree
Showing 20 changed files with 871 additions and 23 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,21 @@ LithoSphere's first release!
### Changed

- PNG.js and zlib.js are now modules instead of globals

## v1.0.3

#### Added

- {constructor}.demFallback

#### Fixed

- {vector/clamped layer}.letPropertiesStyleOverride

## v1.1.0

#### Added

- Model layer type (.dae, .gltf, .obj)
- Bearings (directional arrows) for clamped vector points
- Keyboard navigation controls (wasd = pan, qe = rotate, rf = dolly, tg: zoom)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ Head over to the **[Documentation](https://nasa-ammos.github.io/LithoSphere/)**
- Overlay (upcoming)
- Tile
- Tile3d
- Model (upcoming)
- Model
- Adjustable planetary radii
- Scripts for tiling Digital Elevation Maps (DEM) and custom projections
- Various tile formats:
- TMS
- WMTS
- WMS (upcoming)
- WMS
- Full Proj4 support to render tile sets of any projection
- A suite of pluginable UI controls:
- Compass
Expand Down
2 changes: 1 addition & 1 deletion dist/lithosphere.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/src/core/events.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default class Events {
_matchPlanetsLODToPlanet(): void;
_refreshFrontGroupRotation(): void;
private _onClick;
private _onKeyDown;
_onMouseMove: (e?: any) => void;
private _updateMouseCoords;
private updateHoverInfoPosition;
Expand Down
4 changes: 4 additions & 0 deletions dist/src/layers/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import Tile3dLayerer from './tile3d';
import TileLayerer from './tile';
import ClampedLayerer from './clamped';
import VectorLayerer from './vector';
import ModelLayerer from './model';
interface Private {
layerers: {
tile3d: Tile3dLayerer;
tile: TileLayerer;
clamped: ClampedLayerer;
vector: VectorLayerer;
model: ModelLayerer;
};
}
export default class Layers {
Expand All @@ -18,6 +20,7 @@ export default class Layers {
tile: any;
clamped: any;
vector: any;
model: any;
all: any;
constructor(parent: any);
_reset(): void;
Expand All @@ -29,6 +32,7 @@ export default class Layers {
findLowestMinZoom: () => number;
private getFeatureStyleProp;
getLayerByName: (layerName: string) => any;
hasLayer: (layerName: string) => any;
getFeatureStyle: (layer: any, feature: any, isStrokeless?: boolean) => any;
}
export {};
14 changes: 14 additions & 0 deletions dist/src/layers/model.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default class ModelLayerer {
p: any;
modelCache: any;
constructor(parent: any);
add: (layerObj: any, callback?: Function) => void;
toggle: (name: string, on?: boolean) => boolean;
setOpacity: (name: string, opacity: number) => boolean;
remove: (name: string) => boolean;
private generateModel;
private objToModel;
private daeToModel;
private gltfToModel;
private localizeModel;
}
3 changes: 3 additions & 0 deletions dist/src/lithosphere.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface Private {
container: HTMLElement;
sceneContainer: HTMLElement;
wasInitialized: boolean;
rendererWrapper: any;
renderer: any;
cameras: any;
cameraPositionTarget: number[];
Expand Down Expand Up @@ -42,6 +43,8 @@ export default class LithoSphere {
removeLayer: Function;
toggleLayer: Function;
setLayerOpacity: Function;
getLayerByName: Function;
hasLayer: Function;
addControl: Function;
removeControl: Function;
scene: Scene;
Expand Down
2 changes: 2 additions & 0 deletions dist/src/utils/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ declare const Utils: {
rotateAroundArbAxis(object: any, axis: any, radians: any, noPremultiply?: boolean): void;
getParamString(params: any, baseUrl: string, isUppercase?: boolean): string;
isArray(object: any): boolean;
setChildrenMaterialOpacity(model: any, opacity: number, recurse?: Function): void;
setAllMaterialOpacity(model: any, opacity: any): void;
};
export default Utils;
5 changes: 5 additions & 0 deletions docs/pages/Layers/Clamped/clamped.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ Litho.addLayer(
byProp: {
'prop=images.0.test:blue': {},
},
bearing: {
angleProp: 'yaw_rad', // path.to.bearing.prop
angleUnit: 'rad', //rad | deg
color: 'cyan', //css color
},
},
opacity: 1,
minZoom: 11,
Expand Down
53 changes: 53 additions & 0 deletions docs/pages/Layers/Model/model.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
layout: page
title: Model
permalink: /layers/model
parent: Layers
---

# Model

Adds a model to the scene.

Supports: .glb, .gltf, .dae, .obj

Example

```javascript
Litho.addLayer(
'model',
{
name: 'roverGLTF',
order: 1,
on: true,
path: 'http://localhost:8888/Missions/MSL/Data/models/Perseverance.glb',
// mtlPath: '', //if path is to an obj
opacity: 0.5,
position: {
longitude: 137.3572927368641, // default 0
latitude: -4.674971631163808, // default 0
elevation: -4443.613, // default 0
},
scale: 10, // default 1
rotation: {
// y-up is away from planet center. x is pitch, y is yaw, z is roll
x: Math.PI / 12, // in radians | default 0
y: Math.PI / 1.5, // default 0
z: 0, // default 0
order: 'YXZ', //default YXZ
},
// cache: true, // default true // If true, uses cloned meshes from the first download
},
() => {
console.log('Rover loaded')
//Litho.setLayerOpacity('roverGLTF', 0.25)
//Litho.removeLayer('roverGLTF')
/*
Litho.toggleLayer('roverGLTF', false)
setTimeout(() => {
Litho.toggleLayer('roverGLTF', true)
}, 10000)
*/
}
)
```
2 changes: 2 additions & 0 deletions docs/pages/Layers/layers.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ Litho.addLayer(type, options)
Litho.setLayerOpacity(name, opacity)
Litho.toggleLayer(name)
Litho.removeLayer(name)
Litho.getLayerByName(name)
Litho.hasLayer(name)
```
Loading

0 comments on commit 1c9c331

Please sign in to comment.