-
-
Notifications
You must be signed in to change notification settings - Fork 719
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disabled unsupported Fog rendering, for Terrain3D on Globe
- Loading branch information
Showing
7 changed files
with
116 additions
and
3 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 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,30 @@ | ||
import {terrainUniformValues} from './terrain_program'; | ||
import {Sky} from '../../style/sky'; | ||
import {mat4} from 'gl-matrix'; | ||
|
||
describe('terrainUniformValues', () => { | ||
test('disables fog when in globe projection mode', () => { | ||
const eleDelta = 1.0; | ||
const fogMatrix = mat4.create(); | ||
const sky = new Sky({}); | ||
const pitch = 45; | ||
const isGlobeMode = true; | ||
const uniformValues = terrainUniformValues(eleDelta, fogMatrix, sky, pitch, isGlobeMode); | ||
|
||
expect(uniformValues['u_fog_ground_blend_opacity']).toBe(0); | ||
expect(uniformValues['u_ele_delta']).toBe(eleDelta); | ||
expect(uniformValues['u_fog_matrix']).toBe(fogMatrix); | ||
expect(uniformValues['u_fog_color']).toEqual(sky.properties.get('fog-color')); | ||
expect(uniformValues['u_fog_ground_blend']).toBe(sky.properties.get('fog-ground-blend')); | ||
}); | ||
|
||
test('enables fog when not in globe projection mode', () => { | ||
const eleDelta = 1.0; | ||
const fogMatrix = mat4.create(); | ||
const sky = new Sky({}); | ||
const pitch = 45; | ||
const isGlobeMode = false; | ||
const uniformValues = terrainUniformValues(eleDelta, fogMatrix, sky, pitch, isGlobeMode); | ||
expect(uniformValues['u_fog_ground_blend_opacity']).toBe(sky.calculateFogBlendOpacity(pitch)); | ||
}); | ||
}); |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions
74
test/integration/render/tests/terrain/fog-sky-blend-globe/style.json
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,74 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"height": 256, | ||
"width": 256, | ||
"maxPitch": 120, | ||
"operations": [ | ||
["idle"] | ||
] | ||
} | ||
}, | ||
"timeout": 60000, | ||
"center": [ | ||
-113.335, | ||
35.96 | ||
], | ||
"zoom": 13, | ||
"pitch": 80, | ||
"maxPitch": 180, | ||
"sources": { | ||
"terrain": { | ||
"type": "raster-dem", | ||
"tiles": [ | ||
"local://tiles/{z}-{x}-{y}.terrain.png" | ||
], | ||
"maxzoom": 15, | ||
"tileSize": 256 | ||
}, | ||
"satellite": { | ||
"type": "raster", | ||
"tiles": [ | ||
"local://tiles/{z}-{x}-{y}.satellite.png" | ||
], | ||
"maxzoom": 17, | ||
"tileSize": 256 | ||
} | ||
}, | ||
"layers": [ | ||
{ | ||
"id": "background", | ||
"type": "background", | ||
"paint": { | ||
"background-color": "blue" | ||
} | ||
}, | ||
{ | ||
"id": "raster", | ||
"type": "raster", | ||
"source": "satellite", | ||
"paint": { | ||
"raster-opacity": 1.0 | ||
} | ||
|
||
} | ||
], | ||
"terrain": { | ||
"source": "terrain", | ||
"exaggeration": 2 | ||
}, | ||
"sky": { | ||
"sky-color": "green", | ||
"sky-horizon-blend": 0.5, | ||
"horizon-color": "red", | ||
"horizon-fog-blend": 0.5, | ||
"fog-color": "blue", | ||
"fog-ground-blend": 0.5, | ||
"atmosphere-blend": 0 | ||
}, | ||
"projection": { | ||
"type": "globe" | ||
} | ||
} | ||
|