diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-02-11 23:15:46 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-02-11 23:15:46 +0300 |
commit | 24703c97a15dc5c071d768274d3ebdcd4b4a7324 (patch) | |
tree | 7c1006776c7abe2297a13f855b11962f159840e1 /source/blender/gpu | |
parent | 737d349dbce972459df5db03bf861c28604c3826 (diff) |
GPU shaders / Clay engine : small renaming / cleanup
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/CMakeLists.txt | 6 | ||||
-rw-r--r-- | source/blender/gpu/GPU_shader.h | 2 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_shader.c | 10 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_3D_groundpoint_vert.glsl | 2 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_3D_passthrough_vert.glsl (renamed from source/blender/gpu/shaders/gpu_shader_3D_groundline_vert.glsl) | 0 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_instance_screenspace_variying_color_vert.glsl (renamed from source/blender/gpu/shaders/gpu_shader_3D_lamp_vert.glsl) | 9 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl | 4 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_instance_vert.glsl | 3 |
8 files changed, 22 insertions, 14 deletions
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 72a54712201..8709446bc7b 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -153,14 +153,14 @@ data_to_c_simple(shaders/gpu_shader_3D_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_3D_flat_color_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_3D_smooth_color_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_3D_smooth_color_frag.glsl SRC) +data_to_c_simple(shaders/gpu_shader_3D_passthrough_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_instance_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl SRC) +data_to_c_simple(shaders/gpu_shader_instance_screenspace_variying_color_vert.glsl SRC) -data_to_c_simple(shaders/gpu_shader_3D_groundpoint_vert.glsl SRC) -data_to_c_simple(shaders/gpu_shader_3D_groundline_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_3D_groundline_geom.glsl SRC) -data_to_c_simple(shaders/gpu_shader_3D_lamp_vert.glsl SRC) +data_to_c_simple(shaders/gpu_shader_3D_groundpoint_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_point_uniform_color_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_point_uniform_color_smooth_frag.glsl SRC) diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h index b129c619953..0aa93e7322b 100644 --- a/source/blender/gpu/GPU_shader.h +++ b/source/blender/gpu/GPU_shader.h @@ -137,7 +137,7 @@ typedef enum GPUBuiltinShader { /* lamp drawing */ GPU_SHADER_3D_GROUNDPOINT, GPU_SHADER_3D_GROUNDLINE, - GPU_SHADER_3D_LAMP_COMMON, + GPU_SHADER_3D_SCREENSPACE_VARIYING_COLOR, /* instance */ GPU_SHADER_INSTANCE_UNIFORM_COLOR, GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE, diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c index 491a28e168f..cc58050dc5d 100644 --- a/source/blender/gpu/intern/gpu_shader.c +++ b/source/blender/gpu/intern/gpu_shader.c @@ -70,14 +70,14 @@ extern char datatoc_gpu_shader_3D_vert_glsl[]; extern char datatoc_gpu_shader_3D_flat_color_vert_glsl[]; extern char datatoc_gpu_shader_3D_smooth_color_vert_glsl[]; extern char datatoc_gpu_shader_3D_smooth_color_frag_glsl[]; +extern char datatoc_gpu_shader_3D_passthrough_vert_glsl[]; extern char datatoc_gpu_shader_instance_vert_glsl[]; extern char datatoc_gpu_shader_instance_variying_size_variying_color_vert_glsl[]; +extern char datatoc_gpu_shader_instance_screenspace_variying_color_vert_glsl[]; extern char datatoc_gpu_shader_3D_groundpoint_vert_glsl[]; -extern char datatoc_gpu_shader_3D_groundline_vert_glsl[]; extern char datatoc_gpu_shader_3D_groundline_geom_glsl[]; -extern char datatoc_gpu_shader_3D_lamp_vert_glsl[]; extern char datatoc_gpu_shader_point_uniform_color_frag_glsl[]; extern char datatoc_gpu_shader_point_uniform_color_smooth_frag_glsl[]; @@ -693,12 +693,12 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader) [GPU_SHADER_3D_DEPTH_ONLY] = { datatoc_gpu_shader_3D_vert_glsl, datatoc_gpu_shader_depth_only_frag_glsl }, [GPU_SHADER_3D_GROUNDPOINT] = { datatoc_gpu_shader_3D_groundpoint_vert_glsl, datatoc_gpu_shader_point_uniform_color_frag_glsl }, - [GPU_SHADER_3D_GROUNDLINE] = { datatoc_gpu_shader_3D_groundline_vert_glsl, + [GPU_SHADER_3D_GROUNDLINE] = { datatoc_gpu_shader_3D_passthrough_vert_glsl, datatoc_gpu_shader_uniform_color_frag_glsl, datatoc_gpu_shader_3D_groundline_geom_glsl }, - [GPU_SHADER_3D_LAMP_COMMON] = { datatoc_gpu_shader_3D_lamp_vert_glsl, - datatoc_gpu_shader_flat_color_frag_glsl}, + [GPU_SHADER_3D_SCREENSPACE_VARIYING_COLOR] = { datatoc_gpu_shader_instance_screenspace_variying_color_vert_glsl, + datatoc_gpu_shader_flat_color_frag_glsl}, [GPU_SHADER_2D_POINT_FIXED_SIZE_UNIFORM_COLOR] = { datatoc_gpu_shader_2D_vert_glsl, datatoc_gpu_shader_point_uniform_color_frag_glsl }, diff --git a/source/blender/gpu/shaders/gpu_shader_3D_groundpoint_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_groundpoint_vert.glsl index be6b6014a19..55f410eb25d 100644 --- a/source/blender/gpu/shaders/gpu_shader_3D_groundpoint_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_3D_groundpoint_vert.glsl @@ -1,5 +1,5 @@ -/* Make to be used with dynamic batching so no Model Matrix needed */ +/* Made to be used with dynamic batching so no Model Matrix needed */ uniform mat4 ViewProjectionMatrix; in vec3 pos; diff --git a/source/blender/gpu/shaders/gpu_shader_3D_groundline_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_passthrough_vert.glsl index 60793bf56b6..60793bf56b6 100644 --- a/source/blender/gpu/shaders/gpu_shader_3D_groundline_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_3D_passthrough_vert.glsl diff --git a/source/blender/gpu/shaders/gpu_shader_3D_lamp_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_screenspace_variying_color_vert.glsl index c7ccaf8170c..ba0ac29fb79 100644 --- a/source/blender/gpu/shaders/gpu_shader_3D_lamp_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_instance_screenspace_variying_color_vert.glsl @@ -4,8 +4,11 @@ uniform vec3 screen_vecs[2]; uniform float size; uniform float pixel_size; +/* ---- Instanciated Attribs ---- */ in vec2 pos; -in vec3 lamp_pos; + +/* ---- Per instance Attribs ---- */ +in vec3 world_pos; in vec3 color; flat out vec4 finalColor; @@ -19,8 +22,8 @@ float mul_project_m4_v3_zfac(in vec3 co) void main() { - float pix_size = mul_project_m4_v3_zfac(lamp_pos) * pixel_size; + float pix_size = mul_project_m4_v3_zfac(world_pos) * pixel_size; vec3 screen_pos = screen_vecs[0].xyz * pos.x + screen_vecs[1].xyz * pos.y; - gl_Position = ViewProjectionMatrix * vec4(lamp_pos + screen_pos * size * pix_size, 1.0); + gl_Position = ViewProjectionMatrix * vec4(world_pos + screen_pos * size * pix_size, 1.0); finalColor = vec4(color, 1.0); } diff --git a/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl index 8ea6a979873..9ade68644fe 100644 --- a/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl @@ -1,8 +1,10 @@ uniform mat4 ViewProjectionMatrix; +/* ---- Instanciated Attribs ---- */ in vec3 pos; -/* Instance attrib */ + +/* ---- Per instance Attribs ---- */ in mat4 InstanceModelMatrix; in vec3 color; in float size; diff --git a/source/blender/gpu/shaders/gpu_shader_instance_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_vert.glsl index 7eb321f2996..eac167e8045 100644 --- a/source/blender/gpu/shaders/gpu_shader_instance_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_instance_vert.glsl @@ -1,7 +1,10 @@ uniform mat4 ViewProjectionMatrix; +/* ---- Instanciated Attribs ---- */ in vec3 pos; + +/* ---- Per instance Attribs ---- */ in mat4 InstanceModelMatrix; void main() |