diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-03-29 11:49:49 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-03-30 16:50:06 +0300 |
commit | 9b9fda2122ae38ae6f92f31a21674c55a5a52295 (patch) | |
tree | 31ac693fb868361006222922baed899c072860f5 /source/blender/draw/engines/overlay/shaders/armature_shape_outline_vert.glsl | |
parent | 883326040ec20a8289e619446147792f62e6aa32 (diff) |
Overlay: Port Armature shader to ShaderCreateInfo
Should have no regression.
Diffstat (limited to 'source/blender/draw/engines/overlay/shaders/armature_shape_outline_vert.glsl')
-rw-r--r-- | source/blender/draw/engines/overlay/shaders/armature_shape_outline_vert.glsl | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/source/blender/draw/engines/overlay/shaders/armature_shape_outline_vert.glsl b/source/blender/draw/engines/overlay/shaders/armature_shape_outline_vert.glsl index ddc6328e6a2..29319b3f7ac 100644 --- a/source/blender/draw/engines/overlay/shaders/armature_shape_outline_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/armature_shape_outline_vert.glsl @@ -1,18 +1,6 @@ -/* ---- Instantiated Attrs ---- */ -in vec3 pos; -in vec3 snor; - -/* ---- Per instance Attrs ---- */ -in vec4 color; -in mat4 inst_obmat; - -out vec4 pPos; -out vec3 vPos; -out vec2 ssPos; -out vec2 ssNor; -out vec4 vColSize; -out int inverted; +#pragma BLENDER_REQUIRE(common_view_clipping_lib.glsl) +#pragma BLENDER_REQUIRE(common_view_lib.glsl) /* project to screen space */ vec2 proj(vec4 pos) @@ -25,13 +13,13 @@ void main() vec4 bone_color, state_color; mat4 model_mat = extract_matrix_packed_data(inst_obmat, state_color, bone_color); - vec4 worldPosition = model_mat * vec4(pos, 1.0); - vec4 viewpos = ViewMatrix * worldPosition; + vec4 world_pos = model_mat * vec4(pos, 1.0); + vec4 view_pos = ViewMatrix * world_pos; - vPos = viewpos.xyz; - pPos = ProjectionMatrix * viewpos; + geom_in.vPos = view_pos.xyz; + geom_in.pPos = ProjectionMatrix * view_pos; - inverted = int(dot(cross(model_mat[0].xyz, model_mat[1].xyz), model_mat[2].xyz) < 0.0); + geom_in.inverted = int(dot(cross(model_mat[0].xyz, model_mat[1].xyz), model_mat[2].xyz) < 0.0); /* This is slow and run per vertex, but it's still faster than * doing it per instance on CPU and sending it on via instance attribute. */ @@ -39,13 +27,11 @@ void main() /* TODO: FIX: there is still a problem with this vector * when the bone is scaled or in persp mode. But it's * barely visible at the outline corners. */ - ssNor = normalize(normal_world_to_view(normal_mat * snor).xy); + geom_in.ssNor = normalize(normal_world_to_view(normal_mat * snor).xy); - ssPos = proj(pPos); + geom_in.ssPos = proj(geom_in.pPos); - vColSize = bone_color; + geom_in.vColSize = bone_color; -#ifdef USE_WORLD_CLIP_PLANES - world_clip_planes_calc_clip_distance(worldPosition.xyz); -#endif + view_clipping_distances(world_pos.xyz); } |