pass args as vectors to opengl functions where possible.
This commit is contained in:
@@ -107,7 +107,7 @@ static void gp_draw_stroke_buffer (tGPspoint *points, int totpoints, short thick
|
||||
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 @@ static void gp_draw_stroke_buffer (tGPspoint *points, int totpoints, short thick
|
||||
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 @@ static void gp_draw_stroke_point (bGPDspoint *points, short thickness, short dfl
|
||||
/* 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 @@ static void gp_draw_stroke_3d (bGPDspoint *points, int totpoints, short thicknes
|
||||
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 @@ static void gp_draw_stroke_3d (bGPDspoint *points, int totpoints, short thicknes
|
||||
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 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness_s
|
||||
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);
|
||||
|
||||
@@ -331,8 +331,7 @@ static short gp_stroke_addpoint (tGPsdata *p, const int mval[2], float pressure)
|
||||
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 @@ static short gp_stroke_addpoint (tGPsdata *p, const int mval[2], float pressure)
|
||||
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 @@ static short gp_stroke_addpoint (tGPsdata *p, const int mval[2], float pressure)
|
||||
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 @@ static short gp_stroke_addpoint (tGPsdata *p, const int mval[2], float pressure)
|
||||
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 @@ static void gp_stroke_smooth (tGPsdata *p)
|
||||
/* 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 @@ static void gp_stroke_newfrombuffer (tGPsdata *p)
|
||||
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))
|
||||
|
||||
@@ -1579,7 +1579,7 @@ static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d,
|
||||
|
||||
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();
|
||||
|
||||
|
||||
@@ -258,9 +258,9 @@ static void draw_filled_lasso(wmGesture *gt)
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user