From 48918130a1566ce8aa4bf66d8b3bda35ec240acb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 22 Sep 2011 18:42:16 +0000 Subject: remove redundant code & use GL_LINE_STRIP for object spiral drawing. --- doc/manpage/blender.1 | 4 +- source/blender/editors/space_view3d/drawobject.c | 57 ++++++++++++++-------- .../blender/editors/space_view3d/view3d_header.c | 6 +-- source/blender/render/intern/source/shadeinput.c | 2 +- source/blender/windowmanager/intern/wm_window.c | 10 ++-- 5 files changed, 48 insertions(+), 31 deletions(-) diff --git a/doc/manpage/blender.1 b/doc/manpage/blender.1 index ddf3a79b104..20cd40e32ee 100644 --- a/doc/manpage/blender.1 +++ b/doc/manpage/blender.1 @@ -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:" diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 44d68ded679..65267bb481a 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -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; a31) + if (a+start>=CIRCLE_RESOL) start=-a + 1; - glBegin(GL_LINES); - 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); + + 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); - 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; a31) + if (a+start>=CIRCLE_RESOL) start=-a + 1; - glBegin(GL_LINES); - 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); + + 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); - glEnd(); } } + + glEnd(); } /* draws a circle on x-z plane given the scaling of the circle, assuming that diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 0776ca752a9..44d85af858c 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -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; diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index d8231c7e7d4..956a3d4de7c 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -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; sampletot; shi++, sample++) + for(sample=0; sampletot; shi++, sample++) if(!(shi->mode & MA_SHLESS)) ambient_occlusion(shi); /* stores in shi->ao[] */ } diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index d9ca275c819..405960d0795 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -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; -- cgit v1.2.3