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:
authorJeroen Bakker <jbakker>2022-07-08 13:07:08 +0300
committerJeroen Bakker <jeroen@blender.org>2022-07-08 13:08:31 +0300
commita8f7d41d3898a8d3ae8afb4f95ea9f4f44db2a69 (patch)
treeb965e51a0b44c3a301fbf98a22da953031616f1c /source/blender/draw/intern/shaders
parent2c4dfe3453f09a0877a9c825347df1aef128bea8 (diff)
Draw: Curve outline drawing in object mode.
This patch adds (selected/active) outline around a curve object in object mode. {F13270680} In the past the draw bounds option was enabled for any curve objects. With this patch it isn't needed and will be disabled. In the future the curve outline could also be enabled to improve GPU selection. Reviewed By: dfelinto, HooglyBoogly, fclem Maniphest Tasks: T95933 Differential Revision: https://developer.blender.org/D15308
Diffstat (limited to 'source/blender/draw/intern/shaders')
-rw-r--r--source/blender/draw/intern/shaders/common_hair_lib.glsl35
1 files changed, 23 insertions, 12 deletions
diff --git a/source/blender/draw/intern/shaders/common_hair_lib.glsl b/source/blender/draw/intern/shaders/common_hair_lib.glsl
index e235da91e8d..b82df4a51dc 100644
--- a/source/blender/draw/intern/shaders/common_hair_lib.glsl
+++ b/source/blender/draw/intern/shaders/common_hair_lib.glsl
@@ -164,16 +164,15 @@ float hair_shaperadius(float shape, float root, float tip, float time)
in float dummy;
# endif
-void hair_get_pos_tan_binor_time(bool is_persp,
- mat4 invmodel_mat,
- vec3 camera_pos,
- vec3 camera_z,
- out vec3 wpos,
- out vec3 wtan,
- out vec3 wbinor,
- out float time,
- out float thickness,
- out float thick_time)
+void hair_get_center_pos_tan_binor_time(bool is_persp,
+ mat4 invmodel_mat,
+ vec3 camera_pos,
+ vec3 camera_z,
+ out vec3 wpos,
+ out vec3 wtan,
+ out vec3 wbinor,
+ out float time,
+ out float thickness)
{
int id = hair_get_base_id();
vec4 data = texelFetch(hairPointBuffer, id);
@@ -202,15 +201,27 @@ void hair_get_pos_tan_binor_time(bool is_persp,
wbinor = normalize(cross(camera_vec, wtan));
thickness = hair_shaperadius(hairRadShape, hairRadRoot, hairRadTip, time);
+}
+void hair_get_pos_tan_binor_time(bool is_persp,
+ mat4 invmodel_mat,
+ vec3 camera_pos,
+ vec3 camera_z,
+ out vec3 wpos,
+ out vec3 wtan,
+ out vec3 wbinor,
+ out float time,
+ out float thickness,
+ out float thick_time)
+{
+ hair_get_center_pos_tan_binor_time(
+ is_persp, invmodel_mat, camera_pos, camera_z, wpos, wtan, wbinor, time, thickness);
if (hairThicknessRes > 1) {
thick_time = float(gl_VertexID % hairThicknessRes) / float(hairThicknessRes - 1);
thick_time = thickness * (thick_time * 2.0 - 1.0);
-
/* Take object scale into account.
* NOTE: This only works fine with uniform scaling. */
float scale = 1.0 / length(mat3(invmodel_mat) * wbinor);
-
wpos += wbinor * thick_time * scale;
}
else {