[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37398] branches/soc-2011-onion: Revision: 30792
Jason Wilkins
Jason.A.Wilkins at gmail.com
Sat Jun 11 08:00:10 CEST 2011
Revision: 37398
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37398
Author: jwilkins
Date: 2011-06-11 06:00:10 +0000 (Sat, 11 Jun 2011)
Log Message:
-----------
Revision: 30792
Author: nicholasbishop
Date: 12:38:26 AM, Tuesday, July 27, 2010
Message:
== VPaint ==
* Enabled fast navigate option for vpaint
* Moved fast navigate UI button back to options panel for now
* Fixed vpaint partial redraw, wasn't actually passing the redraw planes in
**jwilkins:
**kept the fast navigate option on the multires panel
**vpaint on multires is supposed to work but it does not
**it appears that there is no mcol layer
Modified Paths:
--------------
branches/soc-2011-onion/source/blender/blenkernel/BKE_DerivedMesh.h
branches/soc-2011-onion/source/blender/blenkernel/intern/DerivedMesh.c
branches/soc-2011-onion/source/blender/blenkernel/intern/cdderivedmesh.c
branches/soc-2011-onion/source/blender/blenkernel/intern/subsurf_ccg.c
branches/soc-2011-onion/source/blender/editors/space_view3d/drawmesh.c
branches/soc-2011-onion/source/blender/editors/space_view3d/drawobject.c
Property Changed:
----------------
branches/soc-2011-onion/
Property changes on: branches/soc-2011-onion
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-30783
/trunk/blender:36833-37386
+ /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-30783,30792
/trunk/blender:36833-37386
Modified: branches/soc-2011-onion/source/blender/blenkernel/BKE_DerivedMesh.h
===================================================================
--- branches/soc-2011-onion/source/blender/blenkernel/BKE_DerivedMesh.h 2011-06-11 02:26:28 UTC (rev 37397)
+++ branches/soc-2011-onion/source/blender/blenkernel/BKE_DerivedMesh.h 2011-06-11 06:00:10 UTC (rev 37398)
@@ -278,6 +278,7 @@
* smooth shaded.
*/
void (*drawMappedFaces)(DerivedMesh *dm,
+ float (*partial_redraw_planes)[4], int fast,
int (*setDrawOptions)(void *userData, int index,
int *drawSmooth_r),
void *userData, int useColors,
Modified: branches/soc-2011-onion/source/blender/blenkernel/intern/DerivedMesh.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenkernel/intern/DerivedMesh.c 2011-06-11 02:26:28 UTC (rev 37397)
+++ branches/soc-2011-onion/source/blender/blenkernel/intern/DerivedMesh.c 2011-06-11 06:00:10 UTC (rev 37398)
@@ -635,9 +635,8 @@
func(userData, i, cent, emdm->vertexCos?emdm->faceNos[i]:efa->n);
}
}
-
/* note, material function is ignored for now. */
-static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int UNUSED(useColors), int (*setMaterial)(int, void *attribs))
+static void emDM_drawMappedFaces(DerivedMesh *dm, float (*partial_redraw_planes)[4], int fast_navigate, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int UNUSED(useColors), int (*setMaterial)(int, void *attribs))
{
EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
EditFace *efa;
Modified: branches/soc-2011-onion/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenkernel/intern/cdderivedmesh.c 2011-06-11 02:26:28 UTC (rev 37397)
+++ branches/soc-2011-onion/source/blender/blenkernel/intern/cdderivedmesh.c 2011-06-11 06:00:10 UTC (rev 37398)
@@ -871,7 +871,14 @@
cdDM_drawFacesTex_common(dm, setDrawOptions, NULL, NULL);
}
-static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs))
+static void cdDM_drawMappedFaces(
+ DerivedMesh *dm,
+ float (*partial_redraw_planes)[4],
+ int fast_navigate,
+ int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r),
+ void *userData,
+ int useColors,
+ int (*setMaterial)(int, void *attribs))
{
CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
MVert *mv = cddm->mvert;
@@ -880,7 +887,7 @@
float *nors= dm->getFaceDataArray(dm, CD_NORMAL);
int i, orig, *index = DM_get_face_data_layer(dm, CD_ORIGINDEX);
- if(cddm_draw_pbvh(dm, NULL, NULL,
+ if(cddm_draw_pbvh(dm, partial_redraw_planes, NULL,
useColors ? GPU_DRAW_ACTIVE_MCOL : 0))
return;
Modified: branches/soc-2011-onion/source/blender/blenkernel/intern/subsurf_ccg.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenkernel/intern/subsurf_ccg.c 2011-06-11 02:26:28 UTC (rev 37397)
+++ branches/soc-2011-onion/source/blender/blenkernel/intern/subsurf_ccg.c 2011-06-11 06:00:10 UTC (rev 37398)
@@ -1880,7 +1880,27 @@
}
}
-static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs)) {
+/* TODO: unify with gpu_buffers.c */
+static void gl_color_from_grid(DMGridData *elem, GridKey *gridkey)
+{
+ float v[3] = {1, 1, 1};
+ int i;
+
+ for(i = 0; i < gridkey->color; ++i) {
+ float *col = GRIDELEM_COLOR(elem, gridkey)[i];
+ interp_v3_v3v3(v, v, col, col[3]);
+ }
+ glColor3fv(v);
+}
+
+static void ccgDM_drawMappedFaces(DerivedMesh *dm,
+ float (*partial_redraw_planes)[4],
+ int fast_navigate,
+ int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r),
+ void *userData,
+ int useColors,
+ int (*setMaterial)(int, void *attribs))
+{
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
CCGSubSurf *ss = ccgdm->ss;
MCol *mcol= NULL;
@@ -1888,16 +1908,23 @@
GridKey *gridkey = ccgSubSurf_getGridKey(ss);
char *faceFlags = ccgdm->faceFlags;
int gridFaces = gridSize - 1, totface;
+ int step = (fast_navigate)? gridSize-1: 1;
- if(ccgdm_draw_pbvh(dm, NULL, NULL, 0, /* TODO, fast nav. */
+ if(ccgdm_draw_pbvh(dm, partial_redraw_planes, NULL, fast_navigate,
useColors ? GPU_DRAW_ACTIVE_MCOL : 0))
return;
if(useColors) {
+ if(fast_navigate) {
+ glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
+ glEnable(GL_COLOR_MATERIAL);
+ }
+ else {
mcol = dm->getFaceDataArray(dm, CD_WEIGHT_MCOL);
if(!mcol)
mcol = dm->getFaceDataArray(dm, CD_MCOL);
}
+ }
totface = ccgSubSurf_getNumFaces(ss);
for(i = 0; i < totface; i++) {
@@ -1933,19 +1960,22 @@
for (S=0; S<numVerts; S++) {
DMGridData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
+ DMGridData *a, *b, *c, *d;
+
if (drawSmooth) {
glShadeModel(GL_SMOOTH);
- for (y=0; y<gridFaces; y++) {
- DMGridData *a, *b;
+ for (y=0; y<gridFaces; y+=step) {
glBegin(GL_QUAD_STRIP);
- for (x=0; x<gridFaces; x++) {
+ for (x=0; x<gridFaces; x+=step) {
a = GRIDELEM_AT(faceGridData, (y+0)*gridSize + x, gridkey);
- b = GRIDELEM_AT(faceGridData, (y+1)*gridSize + x, gridkey);
+ b = GRIDELEM_AT(faceGridData, (y+step)*gridSize + x, gridkey);
if(cp) glColor3ub(cp[3], cp[2], cp[1]);
+ else gl_color_from_grid(a, gridkey);
glNormal3fv(GRIDELEM_NO(a, gridkey));
glVertex3fv(GRIDELEM_CO(a, gridkey));
if(cp) glColor3ub(cp[7], cp[6], cp[5]);
+ else gl_color_from_grid(b, gridkey);
glNormal3fv(GRIDELEM_NO(b, gridkey));
glVertex3fv(GRIDELEM_CO(b, gridkey));
@@ -1955,12 +1985,14 @@
}
a = GRIDELEM_AT(faceGridData, (y+0)*gridSize + x, gridkey);
- b = GRIDELEM_AT(faceGridData, (y+1)*gridSize + x, gridkey);
+ b = GRIDELEM_AT(faceGridData, (y+step)*gridSize + x, gridkey);
if(cp) glColor3ub(cp[15], cp[14], cp[13]);
+ else gl_color_from_grid(a, gridkey);
glNormal3fv(GRIDELEM_NO(a, gridkey));
glVertex3fv(GRIDELEM_CO(a, gridkey));
if(cp) glColor3ub(cp[11], cp[10], cp[9]);
+ else gl_color_from_grid(b, gridkey);
glNormal3fv(GRIDELEM_NO(b, gridkey));
glVertex3fv(GRIDELEM_CO(b, gridkey));
@@ -1971,23 +2003,37 @@
} else {
glShadeModel(GL_FLAT);
glBegin(GL_QUADS);
- for (y=0; y<gridFaces; y++) {
- for (x=0; x<gridFaces; x++) {
- float *a = GRIDELEM_CO_AT(faceGridData, (y+0)*gridSize + x, gridkey);
- float *b = GRIDELEM_CO_AT(faceGridData, (y+0)*gridSize + x + 1, gridkey);
- float *c = GRIDELEM_CO_AT(faceGridData, (y+1)*gridSize + x + 1, gridkey);
- float *d = GRIDELEM_CO_AT(faceGridData, (y+1)*gridSize + x, gridkey);
+ for (y=0; y<gridFaces; y+=step) {
+ for (x=0; x<gridFaces; x+=step) {
+ float *a_co, *b_co, *c_co, *d_co;
- ccgDM_glNormalFast(a, b, c, d);
+ a = GRIDELEM_AT(faceGridData, (y+0)*gridSize + x, gridkey);
+ b = GRIDELEM_AT(faceGridData, (y+0)*gridSize + x + step, gridkey);
+ c = GRIDELEM_AT(faceGridData, (y+step)*gridSize + x + step, gridkey);
+ d = GRIDELEM_AT(faceGridData, (y+step)*gridSize + x, gridkey);
+ a_co = GRIDELEM_CO(a, gridkey);
+ b_co = GRIDELEM_CO(b, gridkey);
+ c_co = GRIDELEM_CO(c, gridkey);
+ d_co = GRIDELEM_CO(d, gridkey);
+
+ ccgDM_glNormalFast(a_co, b_co, c_co, d_co);
+
if(cp) glColor3ub(cp[7], cp[6], cp[5]);
- glVertex3fv(d);
+ else gl_color_from_grid(d, gridkey);
+ glVertex3fv(a_co);
+
if(cp) glColor3ub(cp[11], cp[10], cp[9]);
- glVertex3fv(c);
+ else gl_color_from_grid(c, gridkey);
+ glVertex3fv(b_co);
+
if(cp) glColor3ub(cp[15], cp[14], cp[13]);
- glVertex3fv(b);
+ else gl_color_from_grid(b, gridkey);
+ glVertex3fv(c_co);
+
if(cp) glColor3ub(cp[3], cp[2], cp[1]);
- glVertex3fv(a);
+ else gl_color_from_grid(a, gridkey);
+ glVertex3fv(d_co);
if(cp) cp += 16;
}
@@ -2000,6 +2046,9 @@
}
}
}
+
+ if(fast_navigate)
+ glDisable(GL_COLOR_MATERIAL);
}
static void ccgDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index), void *userData) {
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
Modified: branches/soc-2011-onion/source/blender/editors/space_view3d/drawmesh.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/space_view3d/drawmesh.c 2011-06-11 02:26:28 UTC (rev 37397)
+++ branches/soc-2011-onion/source/blender/editors/space_view3d/drawmesh.c 2011-06-11 06:00:10 UTC (rev 37398)
@@ -670,7 +670,7 @@
dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, me->edit_mesh);
} else if(faceselect) {
if(ob->mode & OB_MODE_WEIGHT_PAINT)
- dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me, 1, GPU_enable_material);
+ dm->drawMappedFaces(dm, NULL, 0, wpaint__setSolidDrawOptions, me, 1, GPU_enable_material);
else
dm->drawMappedFacesTex(dm, me->mface ? draw_tface_mapped__set_draw : NULL, me);
}
Modified: branches/soc-2011-onion/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/space_view3d/drawobject.c 2011-06-11 02:26:28 UTC (rev 37397)
+++ branches/soc-2011-onion/source/blender/editors/space_view3d/drawobject.c 2011-06-11 06:00:10 UTC (rev 37398)
@@ -2026,7 +2026,7 @@
data.cols[2] = actCol;
data.efa_act = efa_act;
- dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, &data, 0, GPU_enable_material);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list