Eevee: Fix error when using texture coordinate on world shaders
authorClément Foucault <foucault.clem@gmail.com>
Wed, 17 Oct 2018 10:17:56 +0000 (12:17 +0200)
committerClément Foucault <foucault.clem@gmail.com>
Wed, 17 Oct 2018 10:18:06 +0000 (12:18 +0200)
Compilation errors were happening on OSX with errors of the type:
```ERROR: Input of fragment shader 'viewNormal' not written by vertex shader```

source/blender/draw/engines/eevee/shaders/background_vert.glsl

index b81aae9bcda13637e57e51049dd2869e343b64e3..c849a577316456c9f068c68965a042f98f51ab0b 100644 (file)
@@ -17,4 +17,14 @@ void main()
        gl_Position = vec4(pos, 1.0, 1.0);
        varposition = viewPosition = vec3(pos, -1.0);
        varnormal = normalize(-varposition);
+
+#ifndef VOLUMETRICS
+       /* Not used in practice but needed to avoid compilation errors. */
+       worldPosition = viewPosition;
+       worldNormal = viewNormal = varnormal;
+#endif
+
+#ifdef ATTRIB
+       pass_attrib(viewPosition);
+#endif
 }