diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-09-06 09:50:59 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-09-06 09:50:59 +0300 |
commit | b41d34040b45b6634c3e81c93003326a3bf1d49a (patch) | |
tree | 057360c7f476a25c99df9ba790a64968bdeec195 /source | |
parent | 518e7685790f28789bbe795f370ee3b1a5f776c6 (diff) | |
parent | 47b7f06d0e13efba04290d4cfa8c28d2342eebf7 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/rigidbody.c | 13 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_knife.c | 12 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_draw.c | 4 |
4 files changed, 20 insertions, 17 deletions
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 341a4d1fde5..5ec3156f4df 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -3619,7 +3619,13 @@ void BKE_ptcache_bake(PTCacheBaker *baker) psys_get_pointcache_start_end(scene, pid->calldata, &cache->startframe, &cache->endframe); } - if (((cache->flag & PTCACHE_BAKED) == 0) && (render || bake)) { + // XXX workaround for regression inroduced in ee3fadd, needs looking into + if (pid->type == PTCACHE_TYPE_RIGIDBODY) { + if ((cache->flag & PTCACHE_REDO_NEEDED || (cache->flag & PTCACHE_SIMULATION_VALID)==0) && (render || bake)) { + BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0); + } + } + else if (((cache->flag & PTCACHE_BAKED) == 0) && (render || bake)) { BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0); } diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index df048ce5036..f75b14579c7 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -1595,8 +1595,12 @@ void BKE_rigidbody_do_simulation(const struct EvaluationContext *eval_ctx, Scene BKE_ptcache_id_time(&pid, scene, ctime, &startframe, &endframe, NULL); cache = rbw->pointcache; + if (ctime <= startframe) { + rbw->ltime = startframe; + return; + } /* make sure we don't go out of cache frame range */ - if (ctime > endframe) { + else if (ctime > endframe) { ctime = endframe; } @@ -1610,12 +1614,9 @@ void BKE_rigidbody_do_simulation(const struct EvaluationContext *eval_ctx, Scene // RB_TODO deal with interpolated, old and baked results bool can_simulate = (ctime == rbw->ltime + 1) && !(cache->flag & PTCACHE_BAKED); - if (cache->flag & PTCACHE_OUTDATED || cache->last_exact == 0) { - rbw->ltime = cache->startframe; - } - - if (BKE_ptcache_read(&pid, ctime, can_simulate)) { + if (BKE_ptcache_read(&pid, ctime, can_simulate) == PTCACHE_READ_EXACT) { BKE_ptcache_validate(cache, (int)ctime); + rbw->ltime = ctime; return; } diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 5aa10620936..433163b2fab 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1229,6 +1229,7 @@ static bool knife_ray_intersect_face( for (; tri_i < tottri; tri_i++) { const float *lv1, *lv2, *lv3; + float ray_tri_uv[2]; tri = kcd->em->looptris[tri_i]; if (tri[0]->f != f) @@ -1240,7 +1241,7 @@ static bool knife_ray_intersect_face( * tesselation edge and might not hit either tesselation tri with * an exact test; * we will exclude hits near real edges by a later test */ - if (isect_ray_tri_epsilon_v3(v1, raydir, lv1, lv2, lv3, &lambda, NULL, KNIFE_FLT_EPS)) { + if (isect_ray_tri_epsilon_v3(v1, raydir, lv1, lv2, lv3, &lambda, ray_tri_uv, KNIFE_FLT_EPS)) { /* check if line coplanar with tri */ normal_tri_v3(tri_norm, lv1, lv2, lv3); plane_from_point_normal_v3(tri_plane, lv1, tri_norm); @@ -1249,8 +1250,7 @@ static bool knife_ray_intersect_face( { return false; } - copy_v3_v3(hit_cageco, v1); - madd_v3_v3fl(hit_cageco, raydir, lambda); + interp_v3_v3v3v3_uv(hit_cageco, lv1, lv2, lv3, ray_tri_uv); /* Now check that far enough away from verts and edges */ lst = knife_get_face_kedges(kcd, f); for (ref = lst->first; ref; ref = ref->next) { @@ -1262,11 +1262,7 @@ static bool knife_ray_intersect_face( return false; } } - - transform_point_by_tri_v3( - hit_co, hit_cageco, - tri[0]->v->co, tri[1]->v->co, tri[2]->v->co, - lv1, lv2, lv3); + interp_v3_v3v3v3_uv(hit_co, tri[0]->v->co, tri[1]->v->co, tri[2]->v->co, ray_tri_uv); return true; } } diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 601de2249f5..1ab1cba2504 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -579,10 +579,10 @@ int GPU_verify_image( if (do_color_management) { srgb_frect = MEM_mallocN(ibuf->x * ibuf->y * sizeof(float) * 4, "floar_buf_col_cor"); gpu_verify_high_bit_srgb_buffer(srgb_frect, ibuf); - frect = srgb_frect + texwinsy * ibuf->x + texwinsx; + frect = srgb_frect + (4 * (texwinsy * ibuf->x + texwinsx)); } else { - frect = ibuf->rect_float + texwinsy * ibuf->x + texwinsx; + frect = ibuf->rect_float + (ibuf->channels * (texwinsy * ibuf->x + texwinsx)); } } else { |