diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-11-26 22:34:04 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-11-26 23:25:33 +0300 |
commit | 0b0322099ccb99833e52196b46c144886b94428c (patch) | |
tree | 461fc482abdbb61cdb660f78682f34a4e0ced8de /source/blender/draw/modes/shaders/particle_strand_vert.glsl | |
parent | aac2eba1aac1fb3fb6278c39aab4042597497313 (diff) |
Fix T57930 : Wrong hair shading in particle edit mode
Implement strand selection visualisation but without any shading.
I think this is not the overlay job to draw the strands shaded.
We can already view the children strands shaded for now but we might add
an option to draw the shaded strand instead of (or in addition to) the
guide strand.
Diffstat (limited to 'source/blender/draw/modes/shaders/particle_strand_vert.glsl')
-rw-r--r-- | source/blender/draw/modes/shaders/particle_strand_vert.glsl | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/source/blender/draw/modes/shaders/particle_strand_vert.glsl b/source/blender/draw/modes/shaders/particle_strand_vert.glsl index d4c35d14182..077d6a64f9b 100644 --- a/source/blender/draw/modes/shaders/particle_strand_vert.glsl +++ b/source/blender/draw/modes/shaders/particle_strand_vert.glsl @@ -1,34 +1,31 @@ uniform mat4 ModelViewProjectionMatrix; -uniform mat3 NormalMatrix; -uniform mat4 ModelViewMatrix; in vec3 pos; -in vec3 nor; -in int ind; -out vec3 tangent; -out vec3 viewPosition; -flat out float colRand; +in float color; -float rand(int s) -{ - int seed = s * 1023423; - - seed = (seed ^ 61) ^ (seed >> 16); - seed *= 9; - seed = seed ^ (seed >> 4); - seed *= 0x27d4eb2d; - seed = seed ^ (seed >> 15); - - float value = float(seed); - value *= 1.0 / 42596.0; - return fract(value); -} +out vec4 finalColor; +#ifdef USE_POINTS +out vec2 radii; +#endif void main() { gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0); - tangent = normalize(NormalMatrix * nor); - viewPosition = (ModelViewMatrix * vec4(pos, 1.0)).xyz; - colRand = rand(ind); + + finalColor = mix(colorWire, colorEdgeSelect, color); + +#ifdef USE_POINTS + gl_PointSize = sizeVertex; + + /* calculate concentric radii in pixels */ + float radius = 0.5 * sizeVertex; + + /* start at the outside and progress toward the center */ + radii[0] = radius; + radii[1] = radius - 1.0; + + /* convert to PointCoord units */ + radii /= sizeVertex; +#endif } |