Revision: 42166
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42166
Author:   campbellbarton
Date:     2011-11-26 05:10:53 +0000 (Sat, 26 Nov 2011)
Log Message:
-----------
pass args as vectors to opengl functions where possible.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/gpencil/drawgpencil.c
    trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
    trunk/blender/source/blender/editors/space_view3d/drawobject.c
    trunk/blender/source/blender/windowmanager/intern/wm_gesture.c

Modified: trunk/blender/source/blender/editors/gpencil/drawgpencil.c
===================================================================
--- trunk/blender/source/blender/editors/gpencil/drawgpencil.c  2011-11-26 
04:07:38 UTC (rev 42165)
+++ trunk/blender/source/blender/editors/gpencil/drawgpencil.c  2011-11-26 
05:10:53 UTC (rev 42166)
@@ -107,7 +107,7 @@
        if (totpoints == 1) {           
                /* draw point */
                glBegin(GL_POINTS);
-                       glVertex2f(points->x, points->y);
+                       glVertex2iv(&points->x);
                glEnd();
        }
        else if (sflag & GP_STROKE_ERASER) {
@@ -132,18 +132,15 @@
                                glBegin(GL_LINE_STRIP);
                                
                                /* need to roll-back one point to ensure that 
there are no gaps in the stroke */
-                               if (i != 0) {
-                                       pt--;
-                                       glVertex2f(pt->x, pt->y);
-                                       pt++;
-                               }
+                               if (i != 0) glVertex2iv(&(pt - 1)->x);
+
                                /* now the point we want... */
-                               glVertex2f(pt->x, pt->y);
+                               glVertex2iv(&pt->x);
                                
                                oldpressure = pt->pressure;
                        }
                        else
-                               glVertex2f(pt->x, pt->y);
+                               glVertex2iv(&pt->x);
                }
                glEnd();
 
@@ -162,7 +159,7 @@
        /* draw point */
        if (sflag & GP_STROKE_3DSPACE) {
                glBegin(GL_POINTS);
-                       glVertex3f(points->x, points->y, points->z);
+                       glVertex3fv(&points->x);
                glEnd();
        }
        else {
@@ -228,18 +225,16 @@
                        glBegin(GL_LINE_STRIP);
                        
                        /* need to roll-back one point to ensure that there are 
no gaps in the stroke */
-                       if (i != 0) {
-                               pt--;
-                               glVertex3f(pt->x, pt->y, pt->z);
-                               pt++;
-                       }
+                       if (i != 0) glVertex3fv(&(pt - 1)->x);
+
                        /* now the point we want... */
-                       glVertex3f(pt->x, pt->y, pt->z);
+                       glVertex3fv(&pt->x);
                        
                        oldpressure = pt->pressure;
                }
-               else
-                       glVertex3f(pt->x, pt->y, pt->z);
+               else {
+                       glVertex3fv(&pt->x);
+               }
        }
        glEnd();
        
@@ -247,7 +242,7 @@
        if (debug) {
                glBegin(GL_POINTS);
                for (i=0, pt=points; i < totpoints && pt; i++, pt++)
-                       glVertex3f(pt->x, pt->y, pt->z);
+                       glVertex3fv(&pt->x);
                glEnd();
        }
 }
@@ -461,7 +456,7 @@
                glBegin(GL_POINTS);
                for (i=0, pt=points; i < totpoints && pt; i++, pt++) {
                        if (sflag & GP_STROKE_2DSPACE) {
-                               glVertex2f(pt->x, pt->y);
+                               glVertex2fv(&pt->x);
                        }
                        else if (sflag & GP_STROKE_2DIMAGE) {
                                const float x= (float)((pt->x * winx) + offsx);

Modified: trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
===================================================================
--- trunk/blender/source/blender/editors/gpencil/gpencil_paint.c        
2011-11-26 04:07:38 UTC (rev 42165)
+++ trunk/blender/source/blender/editors/gpencil/gpencil_paint.c        
2011-11-26 05:10:53 UTC (rev 42166)
@@ -331,8 +331,7 @@
                        pt= (tGPspoint *)(gpd->sbuffer);
                        
                        /* store settings */
-                       pt->x= mval[0];
-                       pt->y= mval[1];
+                       copy_v2_v2_int(&pt->x, mval);
                        pt->pressure= pressure;
                        
                        /* increment buffer size */
@@ -345,8 +344,7 @@
                        pt= ((tGPspoint *)(gpd->sbuffer) + 1);
                        
                        /* store settings */
-                       pt->x= mval[0];
-                       pt->y= mval[1];
+                       copy_v2_v2_int(&pt->x, mval);
                        pt->pressure= pressure;
                        
                        /* if this is just the second point we've added, 
increment the buffer size
@@ -369,8 +367,7 @@
                pt= ((tGPspoint *)(gpd->sbuffer) + gpd->sbuffer_size);
                
                /* store settings */
-               pt->x= mval[0];
-               pt->y= mval[1];
+               copy_v2_v2_int(&pt->x, mval);
                pt->pressure= pressure;
                
                /* increment counters */
@@ -387,8 +384,7 @@
                pt= (tGPspoint *)(gpd->sbuffer);
 
                /* store settings */
-               pt->x= mval[0];
-               pt->y= mval[1];
+               copy_v2_v2_int(&pt->x, mval);
                pt->pressure= pressure;
 
                /* if there's stroke for this poly line session add (or replace 
last) point
@@ -475,9 +471,8 @@
        /* second pass: apply smoothed coordinates */
        for (i=0, spc=smoothArray; i < gpd->sbuffer_size; i++, spc++) {
                tGPspoint *pc= (((tGPspoint *)gpd->sbuffer) + i);
-               
-               pc->x = spc->x;
-               pc->y = spc->y;
+
+               copy_v2_v2_int(&pc->x, &spc->x);
        }
        
        /* free temp array */
@@ -653,7 +648,7 @@
                        depth_arr= MEM_mallocN(sizeof(float) * 
gpd->sbuffer_size, "depth_points");
 
                        for (i=0, ptc=gpd->sbuffer; i < gpd->sbuffer_size; i++, 
ptc++, pt++) {
-                               mval[0]= ptc->x; mval[1]= ptc->y;
+                               copy_v2_v2_int(mval, &ptc->x);
 
                                if ((ED_view3d_autodist_depth(p->ar, mval, 
depth_margin, depth_arr+i) == 0) &&
                                        (i && 
(ED_view3d_autodist_depth_seg(p->ar, mval, mval_prev, depth_margin + 1, 
depth_arr+i) == 0))

Modified: trunk/blender/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawobject.c      
2011-11-26 04:07:38 UTC (rev 42165)
+++ trunk/blender/source/blender/editors/space_view3d/drawobject.c      
2011-11-26 05:10:53 UTC (rev 42166)
@@ -1579,7 +1579,7 @@
 
                        glBegin(GL_LINE_STRIP);
                                for(a= 0; a<reconstruction->camnr; a++, 
camera++) {
-                                       glVertex3f(camera->mat[3][0], 
camera->mat[3][1], camera->mat[3][2]);
+                                       glVertex3fv(camera->mat[3]);
                                }
                        glEnd();
 

Modified: trunk/blender/source/blender/windowmanager/intern/wm_gesture.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_gesture.c      
2011-11-26 04:07:38 UTC (rev 42165)
+++ trunk/blender/source/blender/windowmanager/intern/wm_gesture.c      
2011-11-26 05:10:53 UTC (rev 42166)
@@ -258,9 +258,9 @@
                glColor4f(1.0, 1.0, 1.0, 0.05);
                glBegin(GL_TRIANGLES);
                for (efa = fillfacebase.first; efa; efa=efa->next) {
-                       glVertex2f(efa->v1->co[0], efa->v1->co[1]);
-                       glVertex2f(efa->v2->co[0], efa->v2->co[1]);
-                       glVertex2f(efa->v3->co[0], efa->v3->co[1]);
+                       glVertex2fv(efa->v1->co);
+                       glVertex2fv(efa->v2->co);
+                       glVertex2fv(efa->v3->co);
                }
                glEnd();
                glDisable(GL_BLEND);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to