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>2018-05-02 09:58:29 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-05-02 21:49:38 +0300
commit36bbf8092903f55a317db94c4f7ca48c216b1a89 (patch)
tree4c110e3735a52c8c0d485cd8653215b0415be9b1 /source/blender/draw/modes/shaders
parent46662a289b53f79b9e6fa9c0ed07db8368982b12 (diff)
Armature: Envelope: Small cleanup + don't smooth the distance display.
The actual weighting calculation is not smooth as the bone display. The bone itself can be smooth for esthetic purpose but the distance display should match the underlying weighting formula.
Diffstat (limited to 'source/blender/draw/modes/shaders')
-rw-r--r--source/blender/draw/modes/shaders/armature_envelope_vert.glsl6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/draw/modes/shaders/armature_envelope_vert.glsl b/source/blender/draw/modes/shaders/armature_envelope_vert.glsl
index 6de842fdcb2..f4d7a32ce07 100644
--- a/source/blender/draw/modes/shaders/armature_envelope_vert.glsl
+++ b/source/blender/draw/modes/shaders/armature_envelope_vert.glsl
@@ -4,7 +4,7 @@ uniform mat4 ViewMatrixInverse;
uniform mat4 ViewProjectionMatrix;
/* ---- Instanciated Attribs ---- */
-in vec4 pos; /* w encodes head (== 0.0f), tail (== 1.0f). */
+in vec3 pos;
/* ---- Per instance Attribs ---- */
/* Assumed to be in world coordinate already. */
@@ -21,7 +21,11 @@ void main()
vec3 bone_vec = tailSphere.xyz - headSphere.xyz;
float bone_len = max(1e-8, sqrt(dot(bone_vec, bone_vec)));
float bone_lenrcp = 1.0 / bone_len;
+#ifdef SMOOTH_ENVELOPE
float sinb = (tailSphere.w - headSphere.w) * bone_lenrcp;
+#else
+ const float sinb = 0.0;
+#endif
vec3 y_axis = bone_vec * bone_lenrcp;
vec3 z_axis = normalize(cross(xAxis, -y_axis));