diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-10-03 16:42:05 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-10-03 16:44:12 +0300 |
commit | 89c30ff746010c73968d38ae32b9e04e2f0a8a1a (patch) | |
tree | 93be131b3972e73a726fadb8ec70049cb7f89315 /source/blender/draw/modes/shaders/armature_dof_vert.glsl | |
parent | 34a627f345218c8a6688eb6e72e1892a4e765508 (diff) |
Pose Mode: Add back IK Degrees of freedom display
Diffstat (limited to 'source/blender/draw/modes/shaders/armature_dof_vert.glsl')
-rw-r--r-- | source/blender/draw/modes/shaders/armature_dof_vert.glsl | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/draw/modes/shaders/armature_dof_vert.glsl b/source/blender/draw/modes/shaders/armature_dof_vert.glsl new file mode 100644 index 00000000000..5c89cf644d6 --- /dev/null +++ b/source/blender/draw/modes/shaders/armature_dof_vert.glsl @@ -0,0 +1,30 @@ + +uniform mat4 ViewProjectionMatrix; + +/* ---- Instantiated Attribs ---- */ +in vec2 pos; + +/* ---- Per instance Attribs ---- */ +/* Assumed to be in world coordinate already. */ +in mat4 InstanceModelMatrix; +in vec4 color; +in vec2 amin; +in vec2 amax; + +flat out vec4 finalColor; + +vec3 sphere_project(float ax, float az) +{ + float sine = 1.0 - ax * ax - az * az; + float q3 = sqrt(max(0.0, sine)); + + return vec3(-az * q3, 0.5 - sine, ax * q3) * 2.0; +} + +void main() +{ + vec3 final_pos = sphere_project(pos.x * abs((pos.x > 0.0) ? amax.x : amin.x), + pos.y * abs((pos.y > 0.0) ? amax.y : amin.y)); + gl_Position = ViewProjectionMatrix * (InstanceModelMatrix * vec4(final_pos, 1.0)); + finalColor = color; +} |