From 7d3e34622fb8dcddcbdb274a56fb874c95b4a316 Mon Sep 17 00:00:00 2001 From: Eugene Maksymenko Date: Tue, 18 Jan 2022 15:31:51 +0200 Subject: [PATCH] Read depth texture value from R/X component instead of Z. Set sempler2d to highp explictly. --- .../res/raw/gov_nasa_worldwind_sightlineprogram_frag.glsl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/worldwind/src/main/res/raw/gov_nasa_worldwind_sightlineprogram_frag.glsl b/worldwind/src/main/res/raw/gov_nasa_worldwind_sightlineprogram_frag.glsl index 6b873cf46..a25d8c79b 100644 --- a/worldwind/src/main/res/raw/gov_nasa_worldwind_sightlineprogram_frag.glsl +++ b/worldwind/src/main/res/raw/gov_nasa_worldwind_sightlineprogram_frag.glsl @@ -5,13 +5,14 @@ #ifdef GL_FRAGMENT_PRECISION_HIGH precision highp float; +uniform highp sampler2D depthSampler; #else precision mediump float; +uniform mediump sampler2D depthSampler; #endif uniform float range; uniform vec4 color[2]; -uniform sampler2D depthSampler; varying vec4 sightlinePosition; varying float sightlineDistance; @@ -32,7 +33,7 @@ void main() { /* Compute a mask that's on when the object's depth is less than the sightline's depth. The depth texture contains the scene's minimum depth at each position, from the sightline's point of view. */ vec3 sightlineCoord = clipCoord * 0.5 + 0.5; - float sightlineDepth = texture2D(depthSampler, sightlineCoord.xy).z; + float sightlineDepth = texture2D(depthSampler, sightlineCoord.xy).r; float occludeMask = step(sightlineDepth, sightlineCoord.z); /* Modulate the RGBA color with the computed masks to display fragments according to the sightline's configuration. */