Skip to content

Commit

Permalink
imporve the wind layer #96
Browse files Browse the repository at this point in the history
  • Loading branch information
cavencj committed May 17, 2022
1 parent f419500 commit 2bdb0cb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions modules/wind/WindCanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ class WindCanvas {
_drawPixelParticle(particle, min, max) {
let pointPrev = [particle.x, particle.y]
let pointNext = [particle.xt, particle.yt]
let dx = particle.xt - particle.x
let dy = particle.yt - particle.y
if (dx * dx + dy * dy > 20 * 20) {
return
}
if (
pointNext &&
pointPrev &&
Expand Down
14 changes: 11 additions & 3 deletions modules/wind/WindLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,17 @@ class WindLayer extends Layer {
let camera = this._viewer.camera
let ellipsoid = Cesium.Ellipsoid.WGS84
this._delegate.intersectsCoordinate = coordinate => {
let occluder = new Cesium.EllipsoidalOccluder(ellipsoid, camera.position)
let point = Cesium.Cartesian3.fromDegrees(coordinate[0], coordinate[1])
return occluder.isPointVisible(point)
if (scene.mode === Cesium.SceneMode.SCENE3D) {
let occluder = new Cesium.EllipsoidalOccluder(
ellipsoid,
camera.position
)
let point = Cesium.Cartesian3.fromDegrees(coordinate[0], coordinate[1])
return occluder.isPointVisible(point)
} else if (scene.mode === Cesium.SceneMode.SCENE2D) {
return !(coordinate[0] === -180 || coordinate[0] === 180)
}
return true
}

this._delegate.project = coordinate => {
Expand Down

0 comments on commit 2bdb0cb

Please sign in to comment.