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:
authorJulian Eisel <eiseljulian@gmail.com>2020-02-04 22:06:36 +0300
committerJulian Eisel <eiseljulian@gmail.com>2020-02-04 22:09:03 +0300
commite4605cb155bc26171f4f1bd62a2bbfcce482fb0c (patch)
treeb5d7d666f8b84466f07f748e4477fa9fad1dfac6 /source/blender/draw
parentfd130a711e99723924e99a60a9e11162ca278fd8 (diff)
parentf7ca86369da89a6726bc9edc9bf4e875b2b43c46 (diff)
Merge branch 'blender-v2.82-release'
Diffstat (limited to 'source/blender/draw')
-rw-r--r--source/blender/draw/engines/overlay/overlay_armature.c9
-rw-r--r--source/blender/draw/engines/overlay/overlay_private.h1
-rw-r--r--source/blender/draw/intern/draw_cache_impl_curve.c3
-rw-r--r--source/blender/draw/intern/draw_hair.c28
-rw-r--r--source/blender/draw/intern/shaders/common_hair_lib.glsl9
5 files changed, 19 insertions, 31 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_armature.c b/source/blender/draw/engines/overlay/overlay_armature.c
index c31e63b2550..4571446763c 100644
--- a/source/blender/draw/engines/overlay/overlay_armature.c
+++ b/source/blender/draw/engines/overlay/overlay_armature.c
@@ -153,7 +153,8 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata)
XRAY_FLAG_ENABLED(draw_ctx->v3d);
pd->armature.show_relations = ((draw_ctx->v3d->flag & V3D_HIDE_HELPLINES) == 0) &&
!is_select_mode;
- pd->armature.do_pose_fade_geom = (pd->overlay.flag & V3D_OVERLAY_BONE_SELECT) &&
+ pd->armature.do_pose_xray = (pd->overlay.flag & V3D_OVERLAY_BONE_SELECT) != 0;
+ pd->armature.do_pose_fade_geom = pd->armature.do_pose_xray &&
((draw_ctx->object_mode & OB_MODE_WEIGHT_PAINT) == 0) &&
draw_ctx->object_pose != NULL;
@@ -2238,8 +2239,7 @@ static void armature_context_setup(ArmatureDrawContext *ctx,
float *const_color)
{
const bool is_object_mode = !do_envelope_dist;
- const bool is_xray = (ob->dtx & OB_DRAWXRAY) != 0 ||
- (pd->armature.do_pose_fade_geom && is_pose_mode);
+ const bool is_xray = (ob->dtx & OB_DRAWXRAY) != 0 || (pd->armature.do_pose_xray && is_pose_mode);
const bool draw_as_wire = (ob->dt < OB_SOLID);
const bool is_filled = (!pd->armature.transparent && !draw_as_wire) || !is_object_mode;
const bool is_transparent = pd->armature.transparent || (draw_as_wire && !is_object_mode);
@@ -2424,7 +2424,8 @@ void OVERLAY_pose_draw(OVERLAY_Data *vedata)
DRW_draw_pass(psl->armature_bone_select_ps);
if (DRW_state_is_fbo()) {
- GPU_framebuffer_bind(fbl->overlay_line_fb);
+ GPU_framebuffer_bind(fbl->overlay_line_in_front_fb);
+ GPU_framebuffer_clear_depth(fbl->overlay_line_in_front_fb, 1.0f);
}
DRW_draw_pass(psl->armature_ps[1]);
diff --git a/source/blender/draw/engines/overlay/overlay_private.h b/source/blender/draw/engines/overlay/overlay_private.h
index afec20b477d..f8eeeed42ef 100644
--- a/source/blender/draw/engines/overlay/overlay_private.h
+++ b/source/blender/draw/engines/overlay/overlay_private.h
@@ -300,6 +300,7 @@ typedef struct OVERLAY_PrivateData {
struct {
bool transparent;
bool show_relations;
+ bool do_pose_xray;
bool do_pose_fade_geom;
} armature;
struct {
diff --git a/source/blender/draw/intern/draw_cache_impl_curve.c b/source/blender/draw/intern/draw_cache_impl_curve.c
index 85340fae35d..25699cd7653 100644
--- a/source/blender/draw/intern/draw_cache_impl_curve.c
+++ b/source/blender/draw/intern/draw_cache_impl_curve.c
@@ -949,8 +949,7 @@ void DRW_curve_batch_cache_create_requested(Object *ob)
/* Init batches and request VBOs & IBOs */
if (DRW_batch_requested(cache->batch.surfaces, GPU_PRIM_TRIS)) {
- DRW_ibo_request(cache->batch.surfaces, &cache->ibo.surfaces_tris);
- DRW_vbo_request(cache->batch.surfaces, &cache->ordered.pos_nor);
+ DRW_vbo_request(cache->batch.surfaces, &cache->ordered.loop_pos_nor);
}
if (DRW_batch_requested(cache->batch.surfaces_edges, GPU_PRIM_LINES)) {
DRW_ibo_request(cache->batch.surfaces_edges, &cache->ibo.surfaces_lines);
diff --git a/source/blender/draw/intern/draw_hair.c b/source/blender/draw/intern/draw_hair.c
index 58085cf08c6..08256b931ba 100644
--- a/source/blender/draw/intern/draw_hair.c
+++ b/source/blender/draw/intern/draw_hair.c
@@ -104,12 +104,6 @@ void DRW_hair_init(void)
#endif
}
-typedef struct DRWHairInstanceData {
- DrawData dd;
-
- float mat[4][4];
-} DRWHairInstanceData;
-
static DRWShadingGroup *drw_shgroup_create_hair_procedural_ex(Object *object,
ParticleSystem *psys,
ModifierData *md,
@@ -120,13 +114,7 @@ static DRWShadingGroup *drw_shgroup_create_hair_procedural_ex(Object *object,
/* TODO(fclem): Pass the scene as parameter */
const DRWContextState *draw_ctx = DRW_context_state_get();
Scene *scene = draw_ctx->scene;
- static float unit_mat[4][4] = {
- {1, 0, 0, 0},
- {0, 1, 0, 0},
- {0, 0, 1, 0},
- {0, 0, 0, 1},
- };
- float(*dupli_mat)[4];
+ float dupli_mat[4][4];
Object *dupli_parent = DRW_object_get_dupli_parent(object);
DupliObject *dupli_object = DRW_object_get_dupli(object);
@@ -164,13 +152,6 @@ static DRWShadingGroup *drw_shgroup_create_hair_procedural_ex(Object *object,
}
if ((dupli_parent != NULL) && (dupli_object != NULL)) {
- DRWHairInstanceData *hair_inst_data = (DRWHairInstanceData *)DRW_drawdata_ensure(
- &object->id,
- (DrawEngineType *)&drw_shgroup_create_hair_procedural_ex,
- sizeof(DRWHairInstanceData),
- NULL,
- NULL);
- dupli_mat = hair_inst_data->mat;
if (dupli_object->type & OB_DUPLICOLLECTION) {
copy_m4_m4(dupli_mat, dupli_parent->obmat);
}
@@ -181,14 +162,17 @@ static DRWShadingGroup *drw_shgroup_create_hair_procedural_ex(Object *object,
}
}
else {
- dupli_mat = unit_mat;
+ unit_m4(dupli_mat);
}
DRW_shgroup_uniform_texture(shgrp, "hairPointBuffer", hair_cache->final[subdiv].proc_tex);
DRW_shgroup_uniform_int(shgrp, "hairStrandsRes", &hair_cache->final[subdiv].strands_res, 1);
DRW_shgroup_uniform_int_copy(shgrp, "hairThicknessRes", thickness_res);
DRW_shgroup_uniform_float(shgrp, "hairRadShape", &part->shape, 1);
- DRW_shgroup_uniform_mat4(shgrp, "hairDupliMatrix", dupli_mat);
+ DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[0]", dupli_mat[0]);
+ DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[1]", dupli_mat[1]);
+ DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[2]", dupli_mat[2]);
+ DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[3]", dupli_mat[3]);
DRW_shgroup_uniform_float_copy(shgrp, "hairRadRoot", part->rad_root * part->rad_scale * 0.5f);
DRW_shgroup_uniform_float_copy(shgrp, "hairRadTip", part->rad_tip * part->rad_scale * 0.5f);
DRW_shgroup_uniform_bool_copy(
diff --git a/source/blender/draw/intern/shaders/common_hair_lib.glsl b/source/blender/draw/intern/shaders/common_hair_lib.glsl
index cbcdc947bc7..ffff631e34b 100644
--- a/source/blender/draw/intern/shaders/common_hair_lib.glsl
+++ b/source/blender/draw/intern/shaders/common_hair_lib.glsl
@@ -26,7 +26,7 @@ uniform float hairRadTip = 0.0;
uniform float hairRadShape = 0.5;
uniform bool hairCloseTip = true;
-uniform mat4 hairDupliMatrix;
+uniform vec4 hairDupliMatrix[4];
/* -- Per control points -- */
uniform samplerBuffer hairPointBuffer; /* RGBA32F */
@@ -159,8 +159,11 @@ void hair_get_pos_tan_binor_time(bool is_persp,
wtan = wpos - texelFetch(hairPointBuffer, id - 1).point_position;
}
- wpos = (hairDupliMatrix * vec4(wpos, 1.0)).xyz;
- wtan = -normalize(mat3(hairDupliMatrix) * wtan);
+ mat4 obmat = mat4(
+ hairDupliMatrix[0], hairDupliMatrix[1], hairDupliMatrix[2], hairDupliMatrix[3]);
+
+ wpos = (obmat * vec4(wpos, 1.0)).xyz;
+ wtan = -normalize(mat3(obmat) * wtan);
vec3 camera_vec = (is_persp) ? camera_pos - wpos : camera_z;
wbinor = normalize(cross(camera_vec, wtan));