ソースを参照

assign position in lines shader so fog works

Alexander Rose 5 年 前
コミット
bd3e052130
1 ファイル変更5 行追加0 行削除
  1. 5 0
      src/mol-gl/shader/lines.vert.ts

+ 5 - 0
src/mol-gl/shader/lines.vert.ts

@@ -50,6 +50,11 @@ void main(){
     vec4 start = modelView * vec4(aStart, 1.0);
     vec4 end = modelView * vec4(aEnd, 1.0);
 
+    // assign position
+    vec3 position = (aMapping.y < 0.5) ? aStart : aEnd;
+    vec4 mvPosition = modelView * vec4(position, 1.0);
+    vViewPosition = mvPosition.xyz;
+
     // special case for perspective projection, and segments that terminate either in, or behind, the camera plane
     // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
     // but we need to perform ndc-space calculations in the shader, so we must address this issue directly