diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-10-03 10:59:06 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-10-03 10:59:06 +0300 |
commit | 2bfa061a15762e93f0391e3348f58bcfa512d8fc (patch) | |
tree | b3d51e85572e3272c1e0a4c1817d011f61f81386 /source/blender/blenkernel | |
parent | 21369429168c5799125a63ef728947f4fd6668e9 (diff) | |
parent | 2b3ff61d805ccbb219e773e1a5c69e02b0c90109 (diff) |
Merge branch 'master' into blender2.8
Notes:
- Changes in paint_vertex.c were simple to merge, mainly related on passing
evaluation context.
- Conflicts in EditDM and drawmesh.c are solved using code from blender2.8
branch. Those areas are deprecated and not to be used in final release.
However, it's possible that some reference code from master is lost, so
keep attention when adding alpha support for vertex painting.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_brush.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_paint.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/paint.c | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 34 |
6 files changed, 29 insertions, 31 deletions
diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index dedb75a080a..c1e107e101a 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -70,7 +70,7 @@ void BKE_brush_randomize_texture_coords(struct UnifiedPaintSettings *ups, bool m /* brush curve */ void BKE_brush_curve_preset(struct Brush *b, int preset); float BKE_brush_curve_strength_clamped(struct Brush *br, float p, const float len); -float BKE_brush_curve_strength(struct Brush *br, float p, const float len); +float BKE_brush_curve_strength(const struct Brush *br, float p, const float len); /* sampling */ float BKE_brush_sample_tex_3D( diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 5c7684f9fe1..527c0aeb609 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -230,9 +230,12 @@ typedef struct SculptSession { /* Vertex aligned arrays of weights. */ float *previous_accum; - float *previous_weight; /* Keep track of how much each vertex has been painted (non-airbrush only). */ float *alpha_weight; + + /* Needed to continuously re-apply over the same weights (VP_FLAG_SPRAY disabled). + * Lazy initialize as needed (flag is set to 1 to tag it as uninitialized). */ + struct MDeformVert *dvert_prev; } wpaint; //struct { diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 03b0710c8fc..0300dfe5891 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -966,7 +966,7 @@ void BKE_brush_randomize_texture_coords(UnifiedPaintSettings *ups, bool mask) } /* Uses the brush curve control to find a strength value */ -float BKE_brush_curve_strength(Brush *br, float p, const float len) +float BKE_brush_curve_strength(const Brush *br, float p, const float len) { float strength; diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index dd43bf8b9d8..d1282c1a0fe 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -641,18 +641,8 @@ static void cdDM_drawMappedFaces( /* avoid buffer problems in following code */ } else if (setDrawOptions == NULL) { - const bool show_alpha = true; - if (show_alpha) { - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } - /* just draw the entire face array */ GPU_buffer_draw_elements(dm->drawObject->triangles, GL_TRIANGLES, 0, tot_tri_elem); - - if (show_alpha) { - glDisable(GL_BLEND); - } } else { for (mat_index = 0; mat_index < dm->drawObject->totmaterial; mat_index++) { diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 8c336002ba3..40d02acab1c 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -49,6 +49,7 @@ #include "BKE_brush.h" #include "BKE_colortools.h" +#include "BKE_deform.h" #include "BKE_main.h" #include "BKE_context.h" #include "BKE_crazyspace.h" @@ -689,8 +690,12 @@ void BKE_sculptsession_free_vwpaint_data(struct SculptSession *ss) gmap = &ss->mode.wpaint.gmap; MEM_SAFE_FREE(ss->mode.wpaint.alpha_weight); - MEM_SAFE_FREE(ss->mode.wpaint.previous_weight); MEM_SAFE_FREE(ss->mode.wpaint.previous_accum); + if (ss->mode.wpaint.dvert_prev) { + BKE_defvert_array_free_elems(ss->mode.wpaint.dvert_prev, ss->totvert); + MEM_freeN(ss->mode.wpaint.dvert_prev); + ss->mode.wpaint.dvert_prev = NULL; + } } else { return; diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 764df797ef6..d461e03fcda 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -2199,12 +2199,12 @@ static void ccgDM_buffer_copy_color( for (S = 0; S < numVerts; S++) { for (y = 0; y < gridFaces; y++) { for (x = 0; x < gridFaces; x++) { - copy_v3_v3_uchar(&varray[start + 0], &mloopcol[iface * 16 + 0]); - copy_v3_v3_uchar(&varray[start + 3], &mloopcol[iface * 16 + 12]); - copy_v3_v3_uchar(&varray[start + 6], &mloopcol[iface * 16 + 8]); - copy_v3_v3_uchar(&varray[start + 9], &mloopcol[iface * 16 + 4]); + copy_v4_v4_uchar(&varray[start + 0], &mloopcol[iface * 16 + 0]); + copy_v4_v4_uchar(&varray[start + 4], &mloopcol[iface * 16 + 12]); + copy_v4_v4_uchar(&varray[start + 8], &mloopcol[iface * 16 + 8]); + copy_v4_v4_uchar(&varray[start + 12], &mloopcol[iface * 16 + 4]); - start += 12; + start += 16; iface++; } } @@ -3544,16 +3544,16 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm, float *c = CCG_grid_elem_co(&key, faceGridData, x + 1, y + 1); float *d = CCG_grid_elem_co(&key, faceGridData, x, y + 1); - if (cp) glColor3ubv(&cp[4]); + if (cp) glColor4ubv(&cp[4]); glNormal3fv(ln[1]); glVertex3fv(d); - if (cp) glColor3ubv(&cp[8]); + if (cp) glColor4ubv(&cp[8]); glNormal3fv(ln[2]); glVertex3fv(c); - if (cp) glColor3ubv(&cp[12]); + if (cp) glColor4ubv(&cp[12]); glNormal3fv(ln[3]); glVertex3fv(b); - if (cp) glColor3ubv(&cp[0]); + if (cp) glColor4ubv(&cp[0]); glNormal3fv(ln[0]); glVertex3fv(a); @@ -3571,10 +3571,10 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm, a = CCG_grid_elem(&key, faceGridData, x, y + 0); b = CCG_grid_elem(&key, faceGridData, x, y + 1); - if (cp) glColor3ubv(&cp[0]); + if (cp) glColor4ubv(&cp[0]); glNormal3fv(CCG_elem_no(&key, a)); glVertex3fv(CCG_elem_co(&key, a)); - if (cp) glColor3ubv(&cp[4]); + if (cp) glColor4ubv(&cp[4]); glNormal3fv(CCG_elem_no(&key, b)); glVertex3fv(CCG_elem_co(&key, b)); @@ -3586,10 +3586,10 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm, a = CCG_grid_elem(&key, faceGridData, x, y + 0); b = CCG_grid_elem(&key, faceGridData, x, y + 1); - if (cp) glColor3ubv(&cp[12]); + if (cp) glColor4ubv(&cp[12]); glNormal3fv(CCG_elem_no(&key, a)); glVertex3fv(CCG_elem_co(&key, a)); - if (cp) glColor3ubv(&cp[8]); + if (cp) glColor4ubv(&cp[8]); glNormal3fv(CCG_elem_no(&key, b)); glVertex3fv(CCG_elem_co(&key, b)); @@ -3609,13 +3609,13 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm, ccgDM_glNormalFast(a, b, c, d); - if (cp) glColor3ubv(&cp[4]); + if (cp) glColor4ubv(&cp[4]); glVertex3fv(d); - if (cp) glColor3ubv(&cp[8]); + if (cp) glColor4ubv(&cp[8]); glVertex3fv(c); - if (cp) glColor3ubv(&cp[12]); + if (cp) glColor4ubv(&cp[12]); glVertex3fv(b); - if (cp) glColor3ubv(&cp[0]); + if (cp) glColor4ubv(&cp[0]); glVertex3fv(a); if (cp) cp += 16; |