Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2017-02-15 15:32:35 +0300
committerClément Foucault <foucault.clem@gmail.com>2017-02-15 15:32:35 +0300
commit310593def13f08282534a4820bdbddae4741a297 (patch)
tree7b1c26084518204e9ece4c44f27338200b556cf5 /source/blender/draw
parentb0c125bcd30b96dd8a1fbf46249d3978b15115bf (diff)
Clay Engine: Support vertex normals (smooth shading), no face normals yet.
Diffstat (limited to 'source/blender/draw')
-rw-r--r--source/blender/draw/engines/clay/clay.c2
-rw-r--r--source/blender/draw/engines/clay/shaders/clay_frag.glsl14
-rw-r--r--source/blender/draw/intern/draw_cache.c2
3 files changed, 4 insertions, 14 deletions
diff --git a/source/blender/draw/engines/clay/clay.c b/source/blender/draw/engines/clay/clay.c
index b06d8c3497d..efaec22c77c 100644
--- a/source/blender/draw/engines/clay/clay.c
+++ b/source/blender/draw/engines/clay/clay.c
@@ -609,7 +609,7 @@ static void CLAY_create_cache(CLAY_PassList *passes, CLAY_StorageList *stl, cons
/* Clay Pass */
{
- passes->clay_pass = DRW_pass_create("Clay Pass", DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS);
+ passes->clay_pass = DRW_pass_create("Clay Pass", DRW_STATE_WRITE_COLOR);
stl->storage->ubo_current_id = 0;
}
diff --git a/source/blender/draw/engines/clay/shaders/clay_frag.glsl b/source/blender/draw/engines/clay/shaders/clay_frag.glsl
index 7a38db35bcf..c1fe2df5318 100644
--- a/source/blender/draw/engines/clay/shaders/clay_frag.glsl
+++ b/source/blender/draw/engines/clay/shaders/clay_frag.glsl
@@ -62,13 +62,6 @@ vec3 get_view_space_from_depth(in vec2 uvcoords, in float depth)
}
}
-/* TODO remove this when switching to geometric normals */
-vec3 calculate_view_space_normal(in vec3 viewposition)
-{
- vec3 normal = cross(normalize(dFdx(viewposition)), dfdy_sign * normalize(dFdy(viewposition)));
- return normalize(normal);
-}
-
#ifdef USE_HSV
void rgb_to_hsv(vec3 rgb, out vec3 outcol)
{
@@ -167,15 +160,12 @@ void main() {
vec2 screenco = vec2(gl_FragCoord.xy) / screenres;
float depth = texture(depthtex, screenco).r;
- vec3 position = get_view_space_from_depth(screenco, depth);
- vec3 normal = calculate_view_space_normal(position);
-
/* Manual Depth test */
- /* Doing this test earlier gives problem with dfdx calculations
- * TODO move this before when we have proper geometric normals */
if (gl_FragCoord.z > depth + 1e-5)
discard;
+ vec3 position = get_view_space_from_depth(screenco, depth);
+
#ifdef USE_ROTATION
/* Rotate texture coordinates */
vec2 rotY = vec2(-matcap_rotation.y, matcap_rotation.x);
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c
index 7d5dc6e6d8a..55c07304ec2 100644
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@ -668,7 +668,7 @@ Batch *DRW_cache_surface_get(Object *ob)
BLI_assert(ob->type == OB_MESH);
Mesh *me = ob->data;
- surface = BKE_mesh_batch_cache_get_all_triangles(me);
+ surface = BKE_mesh_batch_cache_get_triangles_with_normals(me);
return surface;
}