dm->release(dm);
}
+/*Jason */
+static void mesh_obmode_foreachScreenVert__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
+{
+ struct { void (*func)(void *userData, MVert *mv, int x, int y, int index); void *userData; ViewContext vc; int clipVerts; } *data = userData;
+ Mesh *me = data->vc.obact->data;
+ MVert *mv = me->mvert+index;
+ //MVert *dmv = CDDM_get_verts(data->vc.obact->derivedFinal)+index;
+ //MVert *mv = CDDM_get_verts(data->vc.obact->derivedFinal)+index;
+ if ((mv->flag & ME_HIDE)==0) {
+ short s[2]= {IS_CLIPPED, 0};
+
+ if (data->clipVerts) {
+ view3d_project_short_clip(data->vc.ar, co, s, 1);
+ } else {
+ view3d_project_short_noclip(data->vc.ar, co, s);
+ }
+ if (s[0]!=IS_CLIPPED)
+ data->func(data->userData, mv, s[0], s[1], index);
+ }
+}
+/*Jason*/
+void mesh_obmode_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, MVert *mv, int x, int y, int index), void *userData, int clipVerts)
+{
+ struct { void (*func)(void *userData, MVert *mv, int x, int y, int index); void *userData; ViewContext vc; int clipVerts; } data;
+ DerivedMesh *dm = mesh_get_derived_final(vc->scene, vc->obact, CD_MASK_BAREMESH);
+
+ data.vc= *vc;
+ data.func = func;
+ data.userData = userData;
+ data.clipVerts = clipVerts;
+
+ if(clipVerts)
+ ED_view3d_local_clipping(vc->rv3d, vc->obact->obmat); /* for local clipping lookups */
+
+ dm->foreachMappedVert(dm, mesh_obmode_foreachScreenVert__mapFunc, &data);
+
+ dm->release(dm);
+}
static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, float *v0co, float *v1co)
{
struct { void (*func)(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index); void *userData; ViewContext vc; int clipVerts; } *data = userData;
bglPolygonOffset(rv3d->dist, 0.0);
}
}
-
+ // Jason
+ if(paint_vertsel_test(ob) && dm->drawSelectedVerts) {
+ glColor3f(0.0f, 0.0f, 0.0f);
+ glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
+ dm->drawSelectedVerts(dm);
+ glPointSize(1.0f);
+ }
dm->release(dm);
}
}
/* ***************** BACKBUF SEL (BBS) ********* */
+/* Jason */
+static void bbs_obmode_mesh_verts__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
+{
+ // TODO: support hidden vertices
+ int offset = (intptr_t) userData;
+ //EditVert *eve = EM_get_vert_for_index(index);
+
+ //if (eve->h==0) {
+ WM_set_framebuffer_index_color(offset+index);
+ bglVertex3fv(co);
+ //}
+}
+/* Jason */
+static void bbs_obmode_mesh_verts(Scene* scene, Object *ob, DerivedMesh *dm, int offset)
+{
+ Mesh *me = (Mesh*)ob->data;
+
+ glPointSize( UI_GetThemeValuef(TH_VERTEX_SIZE) );
+ bglBegin(GL_POINTS);
+ dm->foreachMappedVert(dm, bbs_obmode_mesh_verts__mapFunc, (void*)(intptr_t) offset);
+ bglEnd();
+ glPointSize(1.0);
+}
static void bbs_mesh_verts__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
{
return 0;
}
}
+/* Jason */
+// must have called WM_set_framebuffer_index_color beforehand
+static int bbs_mesh_solid_hide2__setDrawOpts(void *userData, int index, int *UNUSED(drawSmooth_r))
+{
+ Mesh *me = userData;
+ if (!(me->mface[index].flag&ME_HIDE)) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
static void bbs_mesh_solid(Scene *scene, Object *ob)
{
DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask);
EM_free_index_arrays();
}
else {
- bbs_mesh_solid(scene, ob);
+ Mesh *me= ob->data;
+ if(me->editflag & ME_EDIT_VERT_SEL) {
+ DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask);
+ WM_set_framebuffer_index_color(me->totvert+2);
+ glColor3ub(0, 0, 0);
+
+ dm->drawMappedFaces(dm, bbs_mesh_solid_hide2__setDrawOpts, me, 0, GPU_enable_material, NULL);
+
+
+ bbs_obmode_mesh_verts(scene, ob, dm, 1);
+ em_vertoffs = me->totvert+1;
+ dm->release(dm);
+ }
+ else {
+ bbs_mesh_solid(scene, ob);
+ }
}
break;
case OB_CURVE: