[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40470] trunk/blender/source/blender: remove redundant code & use GL_LINE_STRIP for object spiral drawing.
Campbell Barton
ideasman42 at gmail.com
Thu Sep 22 20:42:16 CEST 2011
Revision: 40470
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40470
Author: campbellbarton
Date: 2011-09-22 18:42:16 +0000 (Thu, 22 Sep 2011)
Log Message:
-----------
remove redundant code & use GL_LINE_STRIP for object spiral drawing.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_view3d/drawobject.c
trunk/blender/source/blender/editors/space_view3d/view3d_header.c
trunk/blender/source/blender/render/intern/source/shadeinput.c
trunk/blender/source/blender/render/intern/source/voxeldata.c
trunk/blender/source/blender/windowmanager/intern/wm_window.c
Modified: trunk/blender/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawobject.c 2011-09-22 17:52:27 UTC (rev 40469)
+++ trunk/blender/source/blender/editors/space_view3d/drawobject.c 2011-09-22 18:42:16 UTC (rev 40470)
@@ -5112,6 +5112,7 @@
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 @@
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
Modified: trunk/blender/source/blender/editors/space_view3d/view3d_header.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_header.c 2011-09-22 17:52:27 UTC (rev 40469)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_header.c 2011-09-22 18:42:16 UTC (rev 40470)
@@ -285,14 +285,14 @@
{
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;
Modified: trunk/blender/source/blender/render/intern/source/shadeinput.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/shadeinput.c 2011-09-22 17:52:27 UTC (rev 40469)
+++ trunk/blender/source/blender/render/intern/source/shadeinput.c 2011-09-22 18:42:16 UTC (rev 40470)
@@ -1368,7 +1368,7 @@
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[] */
}
Modified: trunk/blender/source/blender/render/intern/source/voxeldata.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/voxeldata.c 2011-09-22 17:52:27 UTC (rev 40469)
+++ trunk/blender/source/blender/render/intern/source/voxeldata.c 2011-09-22 18:42:16 UTC (rev 40470)
@@ -318,7 +318,7 @@
char path[sizeof(vd->source_path)];
/* only re-cache if dataset needs updating */
- if ((vd->flag & TEX_VD_STILL) || (vd->cachedframe == re->r.cfra))
+ if ((vd == NULL) || (vd->flag & TEX_VD_STILL) || (vd->cachedframe == re->r.cfra))
if (vd->ok) return;
/* clear out old cache, ready for new */
Modified: trunk/blender/source/blender/windowmanager/intern/wm_window.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_window.c 2011-09-22 17:52:27 UTC (rev 40469)
+++ trunk/blender/source/blender/windowmanager/intern/wm_window.c 2011-09-22 18:42:16 UTC (rev 40470)
@@ -111,14 +111,12 @@
#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;
More information about the Bf-blender-cvs
mailing list