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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-02-07 16:22:46 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-02-07 16:22:46 +0300
commitaea91b97fc410468cd55e1ce7c6542dbaef54163 (patch)
treee36a5eb656009f3e1f1ca2a578d001d929d729f2 /source/blender/blenkernel/intern/subsurf_ccg.c
parent65dc616e109f7ba241a550155c1359da3425a108 (diff)
Fix #20887: multires sculpt normals not updated correct in solid
textured draw mode.
Diffstat (limited to 'source/blender/blenkernel/intern/subsurf_ccg.c')
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index dde9ccde6bb..69f02bc6a80 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -1220,6 +1220,21 @@ static void ccgDM_glNormalFast(float *a, float *b, float *c, float *d)
glNormal3fv(no);
}
+static void ccgdm_pbvh_update(CCGDerivedMesh *ccgdm)
+{
+ if(ccgdm->pbvh) {
+ CCGFace **faces;
+ int totface;
+
+ BLI_pbvh_get_grid_updates(ccgdm->pbvh, 1, (void***)&faces, &totface);
+ if(totface) {
+ ccgSubSurf_updateFromFaces(ccgdm->ss, 0, faces, totface);
+ ccgSubSurf_updateNormals(ccgdm->ss, faces, totface);
+ MEM_freeN(faces);
+ }
+ }
+}
+
/* Only used by non-editmesh types */
static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)[4], int fast, int (*setMaterial)(int, void *attribs)) {
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
@@ -1229,17 +1244,9 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
char *faceFlags = ccgdm->faceFlags;
int step = (fast)? gridSize-1: 1;
- if(ccgdm->pbvh && ccgdm->multires.mmd && !fast) {
- CCGFace **faces;
- int totface;
-
- BLI_pbvh_get_grid_updates(ccgdm->pbvh, 1, (void***)&faces, &totface);
- if(totface) {
- ccgSubSurf_updateFromFaces(ss, 0, faces, totface);
- ccgSubSurf_updateNormals(ss, faces, totface);
- MEM_freeN(faces);
- }
+ ccgdm_pbvh_update(ccgdm);
+ if(ccgdm->pbvh && ccgdm->multires.mmd && !fast) {
if(dm->numFaceData) {
/* should be per face */
if(!setMaterial(faceFlags[1]+1, NULL))
@@ -1330,6 +1337,8 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, v
char *faceFlags = ccgdm->faceFlags;
int a, b, i, doDraw, numVerts, matnr, new_matnr, totface;
+ ccgdm_pbvh_update(ccgdm);
+
doDraw = 0;
numVerts = 0;
matnr = -1;
@@ -1484,6 +1493,8 @@ static void ccgDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned ch
unsigned char *cp1, *cp2;
int useTwoSide=1;
+ ccgdm_pbvh_update(ccgdm);
+
cp1= col1;
if(col2) {
cp2= col2;
@@ -1554,6 +1565,8 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
int i, totface, flag, gridSize = ccgSubSurf_getGridSize(ss);
int gridFaces = gridSize - 1;
+ ccgdm_pbvh_update(ccgdm);
+
if(!mcol)
mcol = dm->getFaceDataArray(dm, CD_MCOL);