Skip to content

Commit

Permalink
[temp] Debug horizon line
Browse files Browse the repository at this point in the history
  • Loading branch information
gchoqueux committed Jan 22, 2019
1 parent 4580d50 commit f582554
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Layer/TiledGeometryLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ class TiledGeometryLayer extends GeometryLayer {
node.material.fogDistance = context.view.fogDistance;
}

if (context.horizon != undefined) {
node.material.horizonDistance = context.horizon;
}

if (!requestChildrenUpdate) {
return ObjectRemovalHelper.removeChildren(this, node);
}
Expand Down
1 change: 1 addition & 0 deletions src/Renderer/LayeredMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class LayeredMaterial extends THREE.RawShaderMaterial {
setUniformProperty(this, 'overlayAlpha', 0);
setUniformProperty(this, 'overlayColor', new THREE.Color(1.0, 0.3, 0.0));
setUniformProperty(this, 'objectId', 0);
setUniformProperty(this, 'horizonDistance', 1000000000.0);

// > 0 produces gaps,
// < 0 causes oversampling of textures
Expand Down
5 changes: 5 additions & 0 deletions src/Renderer/Shader/TileFS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

uniform vec3 diffuse;
uniform float opacity;
uniform float horizonDistance;
varying vec3 vUv; // WGS84.x/PM.x, WGS84.y, PM.y

void main() {
Expand Down Expand Up @@ -52,5 +53,9 @@ void main() {
#include <itowns/lighting_fragment>
#include <itowns/overlay_fragment>

// if (fogDepth > horizonDistance && fogDepth < (horizonDistance + 20000.0)) {
// gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
// }

#endif
}
1 change: 1 addition & 0 deletions src/Renderer/Shader/TileVS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ void main() {
#include <fog_vertex>
vUv = vec3(uv_wgs84, (uv_pm > 0.) ? uv_pm : uv_wgs84.y); // set pm=wgs84 if pm=0 (not computed)
vNormal = normalize ( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );
fogDepth = length(mvPosition.xyz);
#endif
}

0 comments on commit f582554

Please sign in to comment.