Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-09-17 17:15:38 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-09-17 17:15:38 +0400
commit17f0ff5f7f05dfff0c7ce298118d58894102e4d0 (patch)
tree4a575eae5d19bbfd9054585ad40c7f33f0cdc6a2 /source/blender/editors
parentfa206e2c72b2301941cd7867a4366341ed7d4b39 (diff)
parent3232102cb8c50ff4463ab0d0de3f47d3196d66ea (diff)
svn merge -r40279:40295 ^/trunk/blender
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/anim_draw.c4
-rw-r--r--source/blender/editors/armature/editarmature.c2
-rw-r--r--source/blender/editors/interface/interface_draw.c26
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c6
-rw-r--r--source/blender/editors/space_action/action_edit.c2
-rw-r--r--source/blender/editors/space_action/action_select.c2
-rw-r--r--source/blender/editors/space_console/console_ops.c2
-rw-r--r--source/blender/editors/space_graph/graph_edit.c2
-rw-r--r--source/blender/editors/space_graph/graph_select.c2
-rw-r--r--source/blender/editors/space_view3d/drawobject.c122
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c12
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c4
13 files changed, 110 insertions, 78 deletions
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 70974386917..d2b1fcc4abd 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -404,9 +404,9 @@ float ANIM_unit_mapping_get_factor (Scene *scene, ID *id, FCurve *fcu, short res
/* if the radians flag is not set, default to using degrees which need conversions */
if ((scene) && (scene->unit.system_rotation == USER_UNIT_ROT_RADIANS) == 0) {
if (restore)
- return M_PI / 180.0; /* degrees to radians */
+ return DEG2RADF(1.0f); /* degrees to radians */
else
- return 180.0 / M_PI; /* radians to degrees */
+ return RAD2DEGF(1.0f); /* radians to degrees */
}
}
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 77ab97b4d57..1cec23b890e 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -361,7 +361,7 @@ static void fix_bonelist_roll (ListBase *bonelist, ListBase *editbonelist)
print_m4("premat", premat);
print_m4("postmat", postmat);
print_m4("difmat", difmat);
- printf ("Roll = %f\n", (-atan2(difmat[2][0], difmat[2][2]) * (180.0/M_PI)));
+ printf ("Roll = %f\n", RAD2DEGF(-atan2(difmat[2][0], difmat[2][2])));
#endif
curBone->roll = (float)-atan2(difmat[2][0], difmat[2][2]);
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 33aeb2df926..8889c419c35 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -959,13 +959,13 @@ static float polar_to_y(float center, float diam, float ampli, float angle)
return center + diam * ampli * sinf(angle);
}
-static void vectorscope_draw_target(float centerx, float centery, float diam, float r, float g, float b)
+static void vectorscope_draw_target(float centerx, float centery, float diam, const float colf[3])
{
float y,u,v;
float tangle=0.f, tampli;
float dangle, dampli, dangle2, dampli2;
- rgb_to_yuv(r,g,b, &y, &u, &v);
+ rgb_to_yuv(colf[0], colf[1], colf[2], &y, &u, &v);
if (u>0 && v>=0) tangle=atanf(v/u);
else if (u>0 && v<0) tangle= atanf(v/u) + 2.0f * (float)M_PI;
else if (u<0) tangle=atanf(v/u) + (float)M_PI;
@@ -975,7 +975,7 @@ static void vectorscope_draw_target(float centerx, float centery, float diam, fl
/* small target vary by 2.5 degree and 2.5 IRE unit */
glColor4f(1.0f, 1.0f, 1.0, 0.12f);
- dangle= 2.5f*(float)M_PI/180.0f;
+ dangle= DEG2RADF(2.5f);
dampli= 2.5f/200.0f;
glBegin(GL_LINE_STRIP);
glVertex2f(polar_to_x(centerx,diam,tampli+dampli,tangle+dangle), polar_to_y(centery,diam,tampli+dampli,tangle+dangle));
@@ -986,9 +986,9 @@ static void vectorscope_draw_target(float centerx, float centery, float diam, fl
glEnd();
/* big target vary by 10 degree and 20% amplitude */
glColor4f(1.0f, 1.0f, 1.0, 0.12f);
- dangle= 10.0f*(float)M_PI/180.0f;
+ dangle= DEG2RADF(10.0f);
dampli= 0.2f*tampli;
- dangle2= 5.0f*(float)M_PI/180.0f;
+ dangle2= DEG2RADF(5.0f);
dampli2= 0.5f*dampli;
glBegin(GL_LINE_STRIP);
glVertex2f(polar_to_x(centerx,diam,tampli+dampli-dampli2,tangle+dangle), polar_to_y(centery,diam,tampli+dampli-dampli2,tangle+dangle));
@@ -1014,13 +1014,13 @@ static void vectorscope_draw_target(float centerx, float centery, float diam, fl
void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti)
{
+ const float skin_rad= DEG2RADF(123.0f); /* angle in radians of the skin tone line */
Scopes *scopes = (Scopes *)but->poin;
rctf rect;
int i, j;
- int skina= 123; /* angle in degree of the skin tone line */
float w, h, centerx, centery, diam;
float alpha;
- float colors[6][3]={{.75,0,0},{.75,.75,0},{0,.75,0},{0,.75,.75},{0,0,.75},{.75,0,.75}};
+ const float colors[6][3]={{.75,0,0},{.75,.75,0},{0,.75,0},{0,.75,.75},{0,0,.75},{.75,0,.75}};
GLint scissor[4];
rect.xmin = (float)recti->xmin+1;
@@ -1056,19 +1056,19 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco
for(j=0; j<5; j++) {
glBegin(GL_LINE_STRIP);
for(i=0; i<=360; i=i+15) {
- float a= i*M_PI/180.0;
- float r= (j+1)/10.0f;
- glVertex2f( polar_to_x(centerx,diam,r,a), polar_to_y(centery,diam,r,a));
+ const float a= DEG2RADF((float)i);
+ const float r= (j+1)/10.0f;
+ glVertex2f(polar_to_x(centerx,diam,r,a), polar_to_y(centery,diam,r,a));
}
glEnd();
}
/* skin tone line */
glColor4f(1.f, 0.4f, 0.f, 0.2f);
- fdrawline( polar_to_x(centerx, diam, 0.5f, skina*M_PI/180.0), polar_to_y(centery,diam,0.5,skina*M_PI/180.0),
- polar_to_x(centerx, diam, 0.1f, skina*M_PI/180.0), polar_to_y(centery,diam,0.1,skina*M_PI/180.0));
+ fdrawline(polar_to_x(centerx, diam, 0.5f, skin_rad), polar_to_y(centery,diam,0.5,skin_rad),
+ polar_to_x(centerx, diam, 0.1f, skin_rad), polar_to_y(centery,diam,0.1,skin_rad));
/* saturation points */
for(i=0; i<6; i++)
- vectorscope_draw_target(centerx, centery, diam, colors[i][0], colors[i][1], colors[i][2]);
+ vectorscope_draw_target(centerx, centery, diam, colors[i]);
if (scopes->ok && scopes->vecscope != NULL) {
/* pixel point cloud */
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 8da693a5166..9d65e8004d7 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -717,7 +717,7 @@ static int project_paint_PickColor(const ProjPaintState *ps, float pt[2], float
* 1 : occluded
2 : occluded with w[3] weights set (need to know in some cases) */
-static int project_paint_occlude_ptv(float pt[3], float v1[3], float v2[3], float v3[3], float w[3], int is_ortho)
+static int project_paint_occlude_ptv(float pt[3], float v1[4], float v2[4], float v3[4], float w[3], int is_ortho)
{
/* if all are behind us, return false */
if(v1[2] > pt[2] && v2[2] > pt[2] && v3[2] > pt[2])
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 73a6e4fad20..767001ff163 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -447,9 +447,9 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush,
if(brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) {
/* brush rotation */
glTranslatef(0.5, 0.5, 0);
- glRotatef((double)((brush->flag & BRUSH_RAKE) ?
- sd->last_angle : sd->special_rotation) * (180.0/M_PI),
- 0.0, 0.0, 1.0);
+ glRotatef((double)RAD2DEGF((brush->flag & BRUSH_RAKE) ?
+ sd->last_angle : sd->special_rotation),
+ 0.0, 0.0, 1.0);
glTranslatef(-0.5f, -0.5f, 0);
/* scale based on tablet pressure */
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index b5dfdcdc668..60662334e20 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -535,7 +535,7 @@ void ACTION_OT_paste (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_enum(ot->srna, "offset", keyframe_paste_offset_items, KEYFRAME_PASTE_OFFSET_CFRA_START, "Offset", "Paste time offset of keys");
- RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merking pasted keys and existing");
+ RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merging pasted keys and existing");
}
/* ******************** Insert Keyframes Operator ************************* */
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index aa29e54f436..32594e710a4 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -580,7 +580,7 @@ void ACTION_OT_select_linked (wmOperatorType *ot)
/* identifiers */
ot->name = "Select Linked";
ot->idname= "ACTION_OT_select_linked";
- ot->description = "Select keyframes occurring the same F-Curves as selected ones";
+ ot->description = "Select keyframes occurring in the same F-Curves as selected ones";
/* api callbacks */
ot->exec= actkeys_select_linked_exec;
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index 4707baa279b..85cf30dfeba 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -604,7 +604,7 @@ void CONSOLE_OT_history_cycle(wmOperatorType *ot)
ot->poll= ED_operator_console_active;
/* properties */
- RNA_def_boolean(ot->srna, "reverse", 0, "Reverse", "reverse cycle history");
+ RNA_def_boolean(ot->srna, "reverse", 0, "Reverse", "Reverse cycle history");
}
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 900aa6f6197..f115fd93c2e 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -763,7 +763,7 @@ void GRAPH_OT_paste (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_enum(ot->srna, "offset", keyframe_paste_offset_items, KEYFRAME_PASTE_OFFSET_CFRA_START, "Offset", "Paste time offset of keys");
- RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merking pasted keys and existing");
+ RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merging pasted keys and existing");
}
/* ******************** Duplicate Keyframes Operator ************************* */
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index b8c5d79df18..40380db03d4 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -585,7 +585,7 @@ void GRAPH_OT_select_linked (wmOperatorType *ot)
/* identifiers */
ot->name = "Select Linked";
ot->idname= "GRAPH_OT_select_linked";
- ot->description = "Select keyframes occurring the same F-Curves as selected ones";
+ ot->description = "Select keyframes occurring in the same F-Curves as selected ones";
/* api callbacks */
ot->exec= graphkeys_select_linked_exec;
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index f3ccf796493..4e185d6603a 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -260,7 +260,9 @@ static float cube[8][3] = {
/* ----------------- OpenGL Circle Drawing - Tables for Optimised Drawing Speed ------------------ */
/* 32 values of sin function (still same result!) */
-static float sinval[32] = {
+#define CIRCLE_RESOL 32
+
+static const float sinval[CIRCLE_RESOL] = {
0.00000000,
0.20129852,
0.39435585,
@@ -296,7 +298,7 @@ static float sinval[32] = {
};
/* 32 values of cos function (still same result!) */
-static float cosval[32] ={
+static const float cosval[CIRCLE_RESOL] = {
1.00000000,
0.97952994,
0.91895781,
@@ -614,28 +616,39 @@ static void draw_empty_image(Object *ob)
glPopMatrix();
}
-void drawcircball(int mode, const float cent[3], float rad, float tmat[][4])
+static void circball_array_fill(float verts[CIRCLE_RESOL][3], const float cent[3], float rad, float tmat[][4])
{
- float vec[3], vx[3], vy[3];
- int a, tot=32;
+ float vx[3], vy[3];
+ float *viter= (float *)verts;
+ unsigned int a;
mul_v3_v3fl(vx, tmat[0], rad);
mul_v3_v3fl(vy, tmat[1], rad);
- glBegin(mode);
- for(a=0; a<tot; a++) {
- vec[0]= cent[0] + *(sinval+a) * vx[0] + *(cosval+a) * vy[0];
- vec[1]= cent[1] + *(sinval+a) * vx[1] + *(cosval+a) * vy[1];
- vec[2]= cent[2] + *(sinval+a) * vx[2] + *(cosval+a) * vy[2];
- glVertex3fv(vec);
+ for (a=0; a < CIRCLE_RESOL; a++, viter += 3) {
+ viter[0]= cent[0] + sinval[a] * vx[0] + cosval[a] * vy[0];
+ viter[1]= cent[1] + sinval[a] * vx[1] + cosval[a] * vy[1];
+ viter[2]= cent[2] + sinval[a] * vx[2] + cosval[a] * vy[2];
}
- glEnd();
+}
+
+void drawcircball(int mode, const float cent[3], float rad, float tmat[][4])
+{
+ float verts[CIRCLE_RESOL][3];
+
+ circball_array_fill(verts, cent, rad, tmat);
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(3, GL_FLOAT, 0, verts);
+ glDrawArrays(mode, 0, CIRCLE_RESOL);
+ glDisableClientState(GL_VERTEX_ARRAY);
}
/* circle for object centers, special_color is for library or ob users */
static void drawcentercircle(View3D *v3d, RegionView3D *rv3d, const float co[3], int selstate, int special_color)
{
const float size= ED_view3d_pixel_size(rv3d, co) * (float)U.obcenter_dia * 0.5f;
+ float verts[CIRCLE_RESOL][3];
/* using gldepthfunc guarantees that it does write z values, but not checks for it, so centers remain visible independt order of drawing */
if(v3d->zbuf) glDepthFunc(GL_ALWAYS);
@@ -651,12 +664,25 @@ static void drawcentercircle(View3D *v3d, RegionView3D *rv3d, const float co[3],
else if (selstate == SELECT) UI_ThemeColorShadeAlpha(TH_SELECT, 0, -80);
else if (selstate == DESELECT) UI_ThemeColorShadeAlpha(TH_TRANSFORM, 0, -80);
}
- drawcircball(GL_POLYGON, co, size, rv3d->viewinv);
-
+
+ circball_array_fill(verts, co, size, rv3d->viewinv);
+
+ /* enable vertex array */
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(3, GL_FLOAT, 0, verts);
+
+ /* 1. draw filled, blended polygon */
+ glDrawArrays(GL_POLYGON, 0, CIRCLE_RESOL);
+
+ /* 2. draw outline */
UI_ThemeColorShadeAlpha(TH_WIRE, 0, -30);
- drawcircball(GL_LINE_LOOP, co, size, rv3d->viewinv);
-
+ glDrawArrays(GL_LINE_LOOP, 0, CIRCLE_RESOL);
+
+ /* finishe up */
+ glDisableClientState(GL_VERTEX_ARRAY);
+
glDisable(GL_BLEND);
+
if(v3d->zbuf) glDepthFunc(GL_LEQUAL);
}
@@ -4600,16 +4626,22 @@ static void tekenhandlesN(Nurb *nu, short sel, short hide_handles)
{
BezTriple *bezt;
float *fp;
- int basecol;
int a;
-
+
if(nu->hide || hide_handles) return;
glBegin(GL_LINES);
-
+
if(nu->type == CU_BEZIER) {
- if(sel) basecol= TH_HANDLE_SEL_FREE;
- else basecol= TH_HANDLE_FREE;
+
+#define TH_HANDLE_COL_TOT ((TH_HANDLE_SEL_FREE - TH_HANDLE_FREE) + 1)
+ /* use MIN2 when indexing to ensure newer files dont read outside the array */
+ unsigned char handle_cols[TH_HANDLE_COL_TOT][3];
+ const int basecol= sel ? TH_HANDLE_SEL_FREE : TH_HANDLE_FREE;
+
+ for (a=0; a < TH_HANDLE_COL_TOT; a++) {
+ UI_GetThemeColor3ubv(basecol + a, handle_cols[a]);
+ }
bezt= nu->bezt;
a= nu->pntsu;
@@ -4618,31 +4650,34 @@ static void tekenhandlesN(Nurb *nu, short sel, short hide_handles)
if( (bezt->f2 & SELECT)==sel) {
fp= bezt->vec[0];
- UI_ThemeColor(basecol + bezt->h1);
+ glColor3ubv(handle_cols[MIN2(bezt->h1, TH_HANDLE_COL_TOT-1)]);
glVertex3fv(fp);
glVertex3fv(fp+3);
- UI_ThemeColor(basecol + bezt->h2);
+ glColor3ubv(handle_cols[MIN2(bezt->h2, TH_HANDLE_COL_TOT-1)]);
glVertex3fv(fp+3);
glVertex3fv(fp+6);
}
else if( (bezt->f1 & SELECT)==sel) {
fp= bezt->vec[0];
- UI_ThemeColor(basecol + bezt->h1);
+ glColor3ubv(handle_cols[MIN2(bezt->h1, TH_HANDLE_COL_TOT-1)]);
glVertex3fv(fp);
glVertex3fv(fp+3);
}
else if( (bezt->f3 & SELECT)==sel) {
fp= bezt->vec[1];
- UI_ThemeColor(basecol + bezt->h2);
+ glColor3ubv(handle_cols[MIN2(bezt->h2, TH_HANDLE_COL_TOT-1)]);
glVertex3fv(fp);
glVertex3fv(fp+3);
}
}
bezt++;
}
+
+#undef TH_HANDLE_COL_TOT
+
}
glEnd();
}
@@ -5127,8 +5162,7 @@ static void draw_textcurs(float textcurs[4][2])
static void drawspiral(const float cent[3], float rad, float tmat[][4], int start)
{
float vec[3], vx[3], vy[3];
- const int tot=32;
- const float tot_inv= (1.0f / 32.0f);
+ const float tot_inv= (1.0f / (float)CIRCLE_RESOL);
int a;
char inverse= FALSE;
@@ -5143,31 +5177,31 @@ static void drawspiral(const float cent[3], float rad, float tmat[][4], int star
copy_v3_v3(vec, cent);
if (inverse==0) {
- for(a=0; a<tot; a++) {
+ for(a=0; a<CIRCLE_RESOL; a++) {
if (a+start>31)
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);
+ 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);
- for(a=0; a<tot; a++) {
+ 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);
+ for(a=0; a<CIRCLE_RESOL; a++) {
if (a+start>31)
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);
+ 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();
}
@@ -5185,9 +5219,9 @@ static void drawcircle_size(float size)
glBegin(GL_LINE_LOOP);
/* coordinates are: cos(degrees*11.25)=x, sin(degrees*11.25)=y, 0.0f=z */
- for (degrees=0; degrees<32; degrees++) {
- x= *(cosval + degrees);
- y= *(sinval + degrees);
+ for (degrees=0; degrees<CIRCLE_RESOL; degrees++) {
+ x= cosval[degrees];
+ y= sinval[degrees];
glVertex3f(x*size, 0.0f, y*size);
}
@@ -5455,8 +5489,7 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
unit_m4(tmat);
- radius=(pd->flag&PFIELD_USEMAXR)?pd->maxrad:1.0f;
- radius*=(float)M_PI/180.0f;
+ radius= DEG2RADF((pd->flag&PFIELD_USEMAXR) ? pd->maxrad : 1.0f);
distance=(pd->flag&PFIELD_USEMAX)?pd->maxdist:0.0f;
if(pd->flag & (PFIELD_USEMAX|PFIELD_USEMAXR)){
@@ -5465,8 +5498,7 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
drawcone(vec, distance * sinf(radius),-distance * cosf(radius),tmat);
}
- radius=(pd->flag&PFIELD_USEMINR)?pd->minrad:1.0f;
- radius*=(float)M_PI/180.0f;
+ radius= DEG2RADF((pd->flag&PFIELD_USEMINR) ? pd->minrad : 1.0f);
distance=(pd->flag&PFIELD_USEMIN)?pd->mindist:0.0f;
if(pd->flag & (PFIELD_USEMIN|PFIELD_USEMINR)){
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index ec3e6ea93bd..d2cb2a6c46f 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -900,9 +900,9 @@ static void v3d_posearmature_buts(uiLayout *layout, Object *ob)
quat_to_eul( tfp->ob_eul,pchan->quat);
else
copy_v3_v3(tfp->ob_eul, pchan->eul);
- tfp->ob_eul[0]*= 180.0/M_PI;
- tfp->ob_eul[1]*= 180.0/M_PI;
- tfp->ob_eul[2]*= 180.0/M_PI;
+ tfp->ob_eul[0]*= RAD2DEGF(1.0f);
+ tfp->ob_eul[1]*= RAD2DEGF(1.0f);
+ tfp->ob_eul[2]*= RAD2DEGF(1.0f);
uiDefBut(block, LABEL, 0, "Location:", 0, 240, 100, 20, 0, 0, 0, 0, 0, "");
uiBlockBeginAlign(block);
@@ -1110,9 +1110,9 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event
if (!pchan) return;
/* make a copy to eul[3], to allow TAB on buttons to work */
- eul[0]= (float)M_PI*tfp->ob_eul[0]/180.0f;
- eul[1]= (float)M_PI*tfp->ob_eul[1]/180.0f;
- eul[2]= (float)M_PI*tfp->ob_eul[2]/180.0f;
+ eul[0]= DEG2RADF(tfp->ob_eul[0]);
+ eul[1]= DEG2RADF(tfp->ob_eul[1]);
+ eul[2]= DEG2RADF(tfp->ob_eul[2]);
if (pchan->rotmode == ROT_MODE_AXISANGLE) {
float quat[4];
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index 45bfb7ca17d..e8660022a8b 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -320,7 +320,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
VECSUB2D(av4, tf_uv[2], tf_uv[3]); normalize_v2(av4);
/* This is the correct angle however we are only comparing angles
- * uvang1 = 90-((angle_normalized_v2v2(av1, av2) * 180.0/M_PI)-90);*/
+ * uvang1 = 90-((angle_normalized_v2v2(av1, av2) * RAD2DEGF(1.0f))-90);*/
uvang1 = angle_normalized_v2v2(av1, av2);
uvang2 = angle_normalized_v2v2(av2, av3);
uvang3 = angle_normalized_v2v2(av3, av4);
@@ -333,7 +333,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
VECSUB(av4, efa->v3->co, efa->v4->co); normalize_v3(av4);
/* This is the correct angle however we are only comparing angles
- * ang1 = 90-((angle_normalized_v3v3(av1, av2) * 180.0/M_PI)-90);*/
+ * ang1 = 90-((angle_normalized_v3v3(av1, av2) * RAD2DEGF(1.0f))-90);*/
ang1 = angle_normalized_v3v3(av1, av2);
ang2 = angle_normalized_v3v3(av2, av3);
ang3 = angle_normalized_v3v3(av3, av4);