Eevee: Make lookdev shader use common_view_lib
authorClément Foucault <foucault.clem@gmail.com>
Tue, 21 May 2019 18:28:14 +0000 (20:28 +0200)
committerClément Foucault <foucault.clem@gmail.com>
Wed, 22 May 2019 11:29:05 +0000 (13:29 +0200)
source/blender/draw/engines/eevee/eevee_materials.c
source/blender/draw/engines/eevee/eevee_shaders.c
source/blender/draw/engines/eevee/shaders/default_world_frag.glsl

index 6757c8e..456f312 100644 (file)
@@ -598,8 +598,11 @@ void EEVEE_materials_init(EEVEE_ViewLayerData *sldata,
     e_data.vert_shadow_shader_str = BLI_string_joinN(
         datatoc_common_view_lib_glsl, datatoc_common_hair_lib_glsl, datatoc_shadow_vert_glsl);
 
-    e_data.default_background = DRW_shader_create(
-        datatoc_background_vert_glsl, NULL, datatoc_default_world_frag_glsl, NULL);
+    e_data.default_background = DRW_shader_create_with_lib(datatoc_background_vert_glsl,
+                                                           NULL,
+                                                           datatoc_default_world_frag_glsl,
+                                                           datatoc_common_view_lib_glsl,
+                                                           NULL);
 
     char *vert_str = BLI_string_joinN(
         datatoc_common_view_lib_glsl, datatoc_common_hair_lib_glsl, datatoc_prepass_vert_glsl);
index dbb43e1..34a3e72 100644 (file)
@@ -110,8 +110,11 @@ void EEVEE_shaders_lightprobe_shaders_init(void)
   e_data.probe_filter_glossy_sh = DRW_shader_create(
       datatoc_lightprobe_vert_glsl, datatoc_lightprobe_geom_glsl, shader_str, filter_defines);
 
-  e_data.probe_default_sh = DRW_shader_create(
-      datatoc_background_vert_glsl, NULL, datatoc_default_world_frag_glsl, NULL);
+  e_data.probe_default_sh = DRW_shader_create_with_lib(datatoc_background_vert_glsl,
+                                                       NULL,
+                                                       datatoc_default_world_frag_glsl,
+                                                       datatoc_common_view_lib_glsl,
+                                                       NULL);
 
   MEM_freeN(shader_str);
 
@@ -178,8 +181,12 @@ GPUShader *EEVEE_shaders_probe_planar_downsample_sh_get(void)
 GPUShader *EEVEE_shaders_default_studiolight_sh_get(void)
 {
   if (e_data.probe_default_studiolight_sh == NULL) {
-    e_data.probe_default_studiolight_sh = DRW_shader_create(
-        datatoc_background_vert_glsl, NULL, datatoc_default_world_frag_glsl, "#define LOOKDEV\n");
+    e_data.probe_default_studiolight_sh = DRW_shader_create_with_lib(
+        datatoc_background_vert_glsl,
+        NULL,
+        datatoc_default_world_frag_glsl,
+        datatoc_common_view_lib_glsl,
+        "#define LOOKDEV\n");
   }
   return e_data.probe_default_studiolight_sh;
 }
index 0be2a8d..7046647 100644 (file)
@@ -5,9 +5,6 @@ uniform vec3 color;
 out vec4 FragColor;
 
 #ifdef LOOKDEV
-uniform mat4 ProjectionMatrix;
-uniform mat4 ProjectionMatrixInverse;
-uniform mat4 ViewMatrixInverse;
 uniform mat3 StudioLightMatrix;
 uniform sampler2D image;
 uniform float studioLightBackground = 1.0;