*** empty log message ***
authorTon Roosendaal <ton@blender.org>
Fri, 1 Oct 2004 14:48:12 +0000 (14:48 +0000)
committerTon Roosendaal <ton@blender.org>
Fri, 1 Oct 2004 14:48:12 +0000 (14:48 +0000)
source/blender/src/editmesh_mods.c
source/blender/src/editview.c

index decc534b6bc5fc354a8820dc19e0ae2031046f8e..af6375fd977dec318a1ae23860e7b4f820d95811 100644 (file)
@@ -322,6 +322,38 @@ int EM_mask_init_backbuf_border(short mcords[][2], short tot, short xmin, short
        
 }
 
+/* circle shaped sample area */
+int EM_init_backbuf_circle(short xs, short ys, short rads)
+{
+       unsigned int *buf, *dr;
+       short xmin, ymin, xmax, ymax, xc, yc;
+       int radsq;
+       
+       if(G.obedit==NULL || G.vd->drawtype<OB_SOLID || (G.vd->flag & V3D_ZBUF_SELECT)==0) return 0;
+       if(em_vertoffs==0) return 0;
+       
+       xmin= xs-rads; xmax= xs+rads;
+       ymin= ys-rads; ymax= ys+rads;
+       dr= buf= read_backbuf(xmin, ymin, xmax, ymax);
+       if(buf==NULL) return 0;
+       
+       /* build selection lookup */
+       selbuf= MEM_callocN(em_vertoffs+1, "selbuf");
+       radsq= rads*rads;
+       for(yc= -rads; yc<=rads; yc++) {
+               for(xc= -rads; xc<=rads; xc++, dr++) {
+                       if(xc*xc + yc*yc < radsq) {
+                               if(*dr>0 && *dr<=em_vertoffs) selbuf[*dr]= 1;
+                       }
+               }
+       }
+
+       MEM_freeN(buf);
+       return 1;
+       
+}
+
+
 static EditVert *findnearestvert_f(short *dist, short sel)
 {
        static EditVert *acto= NULL;
index 65c80f6388af8bd826a8e59e5c0f5efc5e40dff1..9d063c0266a160b7d7be043b795a6e04462d7f3d 100644 (file)
@@ -1341,7 +1341,7 @@ void mesh_selectionCB(int selecting, Object *editobj, short *mval, float rad)
        int index, bbsel=0; // if bbsel we dont clip with screencoords
        short rads= (short)(rad+1.0);
        
-       bbsel= EM_init_backbuf_border(mval[0]-rads, mval[1]-rads, mval[0]+rads, mval[1]+rads);
+       bbsel= EM_init_backbuf_circle(mval[0], mval[1], rads);
        
        if(G.scene->selectmode & SCE_SELECT_VERTEX) {
                if(bbsel==0) calc_meshverts_ext();      /* drawobject.c */