remove redundant code & use GL_LINE_STRIP for object spiral drawing.

This commit is contained in:
Campbell Barton
2011-09-22 18:42:16 +00:00
parent bf7f88566c
commit 48918130a1
5 changed files with 48 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
.TH "BLENDER" "1" "June 03, 2011" "Blender Blender 2\&.57 (sub 1)"
.TH "BLENDER" "1" "September 22, 2011" "Blender Blender 2\&.59 (sub 3)"
.SH NAME
blender \- a 3D modelling and rendering package
@@ -15,7 +15,7 @@ Use Blender to create TV commercials, to make technical visualizations, business
http://www.blender.org
.SH OPTIONS
Blender 2.57 (sub 1)
Blender 2.59 (sub 3)
Usage: blender [args ...] [file] [args ...]
.br
.SS "Render Options:"

View File

@@ -5112,6 +5112,7 @@ static void drawspiral(const float cent[3], float rad, float tmat[][4], int star
const float tot_inv= (1.0f / (float)CIRCLE_RESOL);
int a;
char inverse= FALSE;
float x, y, fac;
if (start < 0) {
inverse = TRUE;
@@ -5121,38 +5122,56 @@ static void drawspiral(const float cent[3], float rad, float tmat[][4], int star
mul_v3_v3fl(vx, tmat[0], rad);
mul_v3_v3fl(vy, tmat[1], rad);
copy_v3_v3(vec, cent);
glBegin(GL_LINE_STRIP);
if (inverse==0) {
copy_v3_v3(vec, cent);
glVertex3fv(vec);
for(a=0; a<CIRCLE_RESOL; a++) {
if (a+start>31)
if (a+start>=CIRCLE_RESOL)
start=-a + 1;
glBegin(GL_LINES);
fac= (float)a * tot_inv;
x= sinval[a+start] * fac;
y= cosval[a+start] * fac;
vec[0]= cent[0] + (x * vx[0] + y * vy[0]);
vec[1]= cent[1] + (x * vx[1] + y * vy[1]);
vec[2]= cent[2] + (x * vx[2] + y * vy[2]);
glVertex3fv(vec);
vec[0]= cent[0] + sinval[a+start] * (vx[0] * (float)a * tot_inv) + cosval[a+start] * (vy[0] * (float)a * tot_inv);
vec[1]= cent[1] + sinval[a+start] * (vx[1] * (float)a * tot_inv) + cosval[a+start] * (vy[1] * (float)a * tot_inv);
vec[2]= cent[2] + sinval[a+start] * (vx[2] * (float)a * tot_inv) + cosval[a+start] * (vy[2] * (float)a * tot_inv);
glVertex3fv(vec);
glEnd();
}
}
else {
a=0;
vec[0]= cent[0] + sinval[a+start] * (vx[0] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[0] * (float)(-a+31) * tot_inv);
vec[1]= cent[1] + sinval[a+start] * (vx[1] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[1] * (float)(-a+31) * tot_inv);
vec[2]= cent[2] + sinval[a+start] * (vx[2] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[2] * (float)(-a+31) * tot_inv);
a= 0;
fac= (float)(CIRCLE_RESOL-1) * tot_inv;
x= sinval[start] * fac;
y= cosval[start] * fac;
vec[0]= cent[0] + (x * vx[0] + y * vy[0]);
vec[1]= cent[1] + (x * vx[1] + y * vy[1]);
vec[2]= cent[2] + (x * vx[2] + y * vy[2]);
glVertex3fv(vec);
for(a=0; a<CIRCLE_RESOL; a++) {
if (a+start>31)
if (a+start>=CIRCLE_RESOL)
start=-a + 1;
glBegin(GL_LINES);
fac= (float)(-a+(CIRCLE_RESOL-1)) * tot_inv;
x= sinval[a+start] * fac;
y= cosval[a+start] * fac;
vec[0]= cent[0] + (x * vx[0] + y * vy[0]);
vec[1]= cent[1] + (x * vx[1] + y * vy[1]);
vec[2]= cent[2] + (x * vx[2] + y * vy[2]);
glVertex3fv(vec);
vec[0]= cent[0] + sinval[a+start] * (vx[0] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[0] * (float)(-a+31) * tot_inv);
vec[1]= cent[1] + sinval[a+start] * (vx[1] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[1] * (float)(-a+31) * tot_inv);
vec[2]= cent[2] + sinval[a+start] * (vx[2] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[2] * (float)(-a+31) * tot_inv);
glVertex3fv(vec);
glEnd();
}
}
glEnd();
}
/* draws a circle on x-z plane given the scaling of the circle, assuming that

View File

@@ -285,14 +285,14 @@ static char *view3d_modeselect_pup(Scene *scene)
{
Object *ob= OBACT;
static char string[256];
const char *title= N_("Mode: %%t");
const char *title= N_("Mode: %t");
char *str = string;
if(U.transopts&USER_TR_IFACE)
title= BLF_gettext(title);
sprintf(str, title);
BLI_strncpy(str, title, sizeof(string));
str += modeselect_addmode(str, N_("Object Mode"), OB_MODE_OBJECT, ICON_OBJECT_DATA);
if(ob==NULL || ob->data==NULL) return string;

View File

@@ -1368,7 +1368,7 @@ void shade_samples_do_AO(ShadeSample *ssamp)
if(((shi->passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT)))
|| (shi->passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT)))
for(sample=0, shi= ssamp->shi; sample<ssamp->tot; shi++, sample++)
for(sample=0; sample<ssamp->tot; shi++, sample++)
if(!(shi->mode & MA_SHLESS))
ambient_occlusion(shi); /* stores in shi->ao[] */
}

View File

@@ -111,14 +111,12 @@ static void wm_window_check_position(rcti *rect)
#endif
if(rect->xmin < 0) {
d= rect->xmin;
rect->xmax -= d;
rect->xmin -= d;
rect->xmax -= rect->xmin;
rect->xmin = 0;
}
if(rect->ymin < 0) {
d= rect->ymin;
rect->ymax -= d;
rect->ymin -= d;
rect->ymax -= rect->ymin;
rect->ymin = 0;
}
if(rect->xmax > width) {
d= rect->xmax - width;