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
parentfa206e2c72b2301941cd7867a4366341ed7d4b39 (diff)
parent3232102cb8c50ff4463ab0d0de3f47d3196d66ea (diff)
svn merge -r40279:40295 ^/trunk/blender
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenfont/intern/blf.c7
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c95
-rw-r--r--source/blender/blenfont/intern/blf_internal_types.h8
-rw-r--r--source/blender/blenkernel/intern/constraint.c4
-rw-r--r--source/blender/blenkernel/intern/curve.c2
-rw-r--r--source/blender/blenkernel/intern/effect.c2
-rw-r--r--source/blender/blenkernel/intern/particle.c2
-rw-r--r--source/blender/blenkernel/intern/screen.c3
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c2
-rw-r--r--source/blender/blenlib/BLI_voxel.h8
-rw-r--r--source/blender/blenlib/intern/voxel.c10
-rw-r--r--source/blender/blenloader/intern/readfile.c2
-rw-r--r--source/blender/collada/AnimationExporter.cpp8
-rw-r--r--source/blender/collada/AnimationImporter.cpp8
-rw-r--r--source/blender/collada/CameraExporter.cpp2
-rw-r--r--source/blender/collada/DocumentImporter.cpp6
-rw-r--r--source/blender/collada/TransformReader.cpp4
-rw-r--r--source/blender/collada/TransformWriter.cpp6
-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
-rw-r--r--source/blender/makesdna/DNA_node_types.h9
-rw-r--r--source/blender/render/intern/include/voxeldata.h2
-rw-r--r--source/blender/render/intern/source/convertblender.c6
-rw-r--r--source/blender/render/intern/source/volumetric.c10
-rw-r--r--source/blender/render/intern/source/voxeldata.c2
36 files changed, 230 insertions, 166 deletions
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index fc812d652b3..577697de594 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -486,6 +486,13 @@ static void blf_draw__start(FontBLF *font)
if (font->flags & BLF_ROTATION)
glRotatef(font->angle, 0.0f, 0.0f, 1.0f);
+
+ if(font->shadow || font->blur)
+ glGetFloatv(GL_CURRENT_COLOR, font->orig_col);
+
+ /* always bind the texture for the first glyph */
+ font->tex_bind_state= -1;
+
}
static void blf_draw__end(void)
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 9b39cb65cba..7a1fa8c80b0 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -185,7 +185,7 @@ static void blf_glyph_cache_texture(FontBLF *font, GlyphCacheBLF *gc)
memset((void *)buf, 0, tot_mem);
glGenTextures(1, &gc->textures[gc->cur_tex]);
- glBindTexture(GL_TEXTURE_2D, gc->textures[gc->cur_tex]);
+ glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state= gc->textures[gc->cur_tex]));
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -326,23 +326,25 @@ static void blf_texture_draw(float uv[2][2], float dx, float y1, float dx1, floa
}
-static void blf_texture5_draw(float uv[2][2], float x1, float y1, float x2, float y2)
+static void blf_texture5_draw(const float shadow_col[4], float uv[2][2], float x1, float y1, float x2, float y2)
{
- float soft[25]= {
- 1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f,
- 1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f,
- 2/60.0f, 5/60.0f, 8/60.0f, 5/60.0f, 2/60.0f,
- 1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f,
- 1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f};
+ float soft[25]= {1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f,
+ 1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f,
+ 2/60.0f, 5/60.0f, 8/60.0f, 5/60.0f, 2/60.0f,
+ 1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f,
+ 1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f};
float color[4], *fp= soft;
int dx, dy;
-
- glGetFloatv(GL_CURRENT_COLOR, color);
+
+ color[0]= shadow_col[0];
+ color[1]= shadow_col[1];
+ color[2]= shadow_col[2];
for(dx=-2; dx<3; dx++) {
for(dy=-2; dy<3; dy++, fp++) {
- glColor4f(color[0], color[1], color[2], fp[0]*color[3]);
+ color[3]= *(fp) * shadow_col[3];
+ glColor4fv(color);
blf_texture_draw(uv, x1+dx, y1+dy, x2+dx, y2+dy);
}
}
@@ -350,17 +352,23 @@ static void blf_texture5_draw(float uv[2][2], float x1, float y1, float x2, floa
glColor4fv(color);
}
-static void blf_texture3_draw(float uv[2][2], float x1, float y1, float x2, float y2)
+static void blf_texture3_draw(const float shadow_col[4], float uv[2][2], float x1, float y1, float x2, float y2)
{
- float soft[9]= {1/16.0f, 2/16.0f, 1/16.0f, 2/16.0f, 4/16.0f, 2/16.0f, 1/16.0f, 2/16.0f, 1/16.0f};
+ float soft[9]= {1/16.0f, 2/16.0f, 1/16.0f,
+ 2/16.0f,4/16.0f, 2/16.0f,
+ 1/16.0f, 2/16.0f, 1/16.0f};
+
float color[4], *fp= soft;
int dx, dy;
-
- glGetFloatv(GL_CURRENT_COLOR, color);
-
+
+ color[0]= shadow_col[0];
+ color[1]= shadow_col[1];
+ color[2]= shadow_col[2];
+
for(dx=-1; dx<2; dx++) {
for(dy=-1; dy<2; dy++, fp++) {
- glColor4f(color[0], color[1], color[2], fp[0]*color[3]);
+ color[3]= *(fp) * shadow_col[3];
+ glColor4fv(color);
blf_texture_draw(uv, x1+dx, y1+dy, x2+dx, y2+dy);
}
}
@@ -370,18 +378,15 @@ static void blf_texture3_draw(float uv[2][2], float x1, float y1, float x2, floa
int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
{
- GlyphCacheBLF *gc;
- GLint cur_tex;
float dx, dx1;
float y1, y2;
float xo, yo;
- float color[4];
if ((!g->width) || (!g->height))
return(1);
if (g->build_tex == 0) {
- gc= font->glyph_cache;
+ GlyphCacheBLF *gc= font->glyph_cache;
if (font->max_tex_size == -1)
glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&font->max_tex_size);
@@ -453,22 +458,27 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
return(0);
}
- glGetIntegerv(GL_TEXTURE_2D_BINDING_EXT, &cur_tex);
- if (cur_tex != g->tex)
- glBindTexture(GL_TEXTURE_2D, g->tex);
+ if (font->tex_bind_state != g->tex) {
+ glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state= g->tex));
+ }
if (font->flags & BLF_SHADOW) {
- glGetFloatv(GL_CURRENT_COLOR, color);
- glColor4fv(font->shadow_col);
-
- if (font->shadow == 3)
- blf_texture3_draw(g->uv, dx, y1, dx1, y2);
- else if (font->shadow == 5)
- blf_texture5_draw(g->uv, dx, y1, dx1, y2);
- else
- blf_texture_draw(g->uv, dx, y1, dx1, y2);
- glColor4fv(color);
+ switch(font->shadow) {
+ case 3:
+ blf_texture3_draw(font->shadow_col, g->uv, dx, y1, dx1, y2);
+ break;
+ case 5:
+ blf_texture5_draw(font->shadow_col, g->uv, dx, y1, dx1, y2);
+ break;
+ default:
+ glColor4fv(font->shadow_col);
+ blf_texture_draw(g->uv, dx, y1, dx1, y2);
+ break;
+ }
+
+ glColor4fv(font->orig_col);
+
x= xo;
y= yo;
@@ -478,12 +488,17 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
y2= y + g->pos_y - g->height;
}
- if (font->blur==3)
- blf_texture3_draw(g->uv, dx, y1, dx1, y2);
- else if (font->blur==5)
- blf_texture5_draw(g->uv, dx, y1, dx1, y2);
- else
- blf_texture_draw(g->uv, dx, y1, dx1, y2);
+ switch(font->blur) {
+ case 3:
+ blf_texture3_draw(font->orig_col, g->uv, dx, y1, dx1, y2);
+ break;
+ case 5:
+ blf_texture5_draw(font->orig_col, g->uv, dx, y1, dx1, y2);
+ break;
+ default:
+ blf_texture_draw(g->uv, dx, y1, dx1, y2);
+ break;
+ }
return(1);
}
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h
index 9840e6446ef..1450ad39ad8 100644
--- a/source/blender/blenfont/intern/blf_internal_types.h
+++ b/source/blender/blenfont/intern/blf_internal_types.h
@@ -161,7 +161,10 @@ typedef struct FontBLF {
/* shadow color. */
float shadow_col[4];
-
+
+ /* store color here when drawing shadow or blur. */
+ float orig_col[4];
+
/* Multiplied this matrix with the current one before
* draw the text! see blf_draw__start.
*/
@@ -179,6 +182,9 @@ typedef struct FontBLF {
/* max texture size. */
int max_tex_size;
+ /* current opengl texture bind, avoids calling glGet */
+ int tex_bind_state;
+
/* font options. */
int flags;
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index e847e0961ef..7472e03d6d1 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -2167,7 +2167,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
if (data->type < 10) {
/* extract rotation (is in whatever space target should be in) */
mat4_to_eul(vec, tempmat);
- mul_v3_fl(vec, (float)(180.0/M_PI)); /* rad -> deg */
+ mul_v3_fl(vec, RAD2DEGF(1.0f)); /* rad -> deg */
axis= data->type;
}
else if (data->type < 20) {
@@ -3325,7 +3325,7 @@ static void transform_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
break;
case 1: /* rotation (convert to degrees first) */
mat4_to_eulO(dvec, cob->rotOrder, ct->matrix);
- mul_v3_fl(dvec, (float)(180.0/M_PI)); /* rad -> deg */
+ mul_v3_fl(dvec, RAD2DEGF(1.0f)); /* rad -> deg */
break;
default: /* location */
copy_v3_v3(dvec, ct->matrix[3]);
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 3c693fd83a4..c0d2eca9217 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -1925,7 +1925,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
/* flip rotation if needs be */
cross_v3_v3v3(cross_tmp, vec_1, vec_2);
normalize_v3(cross_tmp);
- if(angle_normalized_v3v3(bevp_first->dir, cross_tmp) < 90.0f/(float)(180.0/M_PI))
+ if(angle_normalized_v3v3(bevp_first->dir, cross_tmp) < DEG2RADF(90.0f))
angle = -angle;
bevp2= (BevPoint *)(bl+1);
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index c4a98477380..500d4ae13f7 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -571,7 +571,7 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU
if(falloff == 0.0f)
break;
- r_fac=saacos(fac/len_v3(efd->vec_to_point))*180.0f/(float)M_PI;
+ r_fac= RAD2DEGF(saacos(fac/len_v3(efd->vec_to_point)));
falloff*= falloff_func_rad(eff->pd, r_fac);
break;
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 414261547d7..ad870bb0bb8 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -2544,7 +2544,7 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
normalize_v3(v1);
normalize_v3(v2);
- d = saacos(dot_v3v3(v1, v2)) * 180.0f/(float)M_PI;
+ d = RAD2DEGF(saacos(dot_v3v3(v1, v2)));
}
if(p_max > p_min)
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index 50b3e32278a..ef1b75e5913 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -277,8 +277,7 @@ void BKE_area_region_free(SpaceType *st, ARegion *ar)
ar->v2d.tab_offset= NULL;
}
- if(ar)
- BLI_freelistN(&ar->panels);
+ BLI_freelistN(&ar->panels);
}
/* not area itself */
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 43747fde729..e5d74177c91 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -2132,7 +2132,7 @@ static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x
}
// Rotate
- rotate_radians = ((float)M_PI*transform->rotIni)/180.0f;
+ rotate_radians = DEG2RADF(transform->rotIni);
transform_image(x,y, ibuf1, out, scale_x, scale_y, translate_x, translate_y, rotate_radians, transform->interpolation);
}
diff --git a/source/blender/blenlib/BLI_voxel.h b/source/blender/blenlib/BLI_voxel.h
index 41f8bfab729..8dd95a897ae 100644
--- a/source/blender/blenlib/BLI_voxel.h
+++ b/source/blender/blenlib/BLI_voxel.h
@@ -36,9 +36,9 @@
#define V_I(x, y, z, res) ( (z)*(res)[1]*(res)[0] + (y)*(res)[0] + (x) )
/* all input coordinates must be in bounding box 0.0 - 1.0 */
-float voxel_sample_nearest(float *data, int *res, float *co);
-float voxel_sample_trilinear(float *data, int *res, float *co);
-float voxel_sample_triquadratic(float *data, int *res, float *co);
-float voxel_sample_tricubic(float *data, int *res, float *co, int bspline);
+float voxel_sample_nearest(float *data, const int res[3], const float co[3]);
+float voxel_sample_trilinear(float *data, const int res[3], const float co[3]);
+float voxel_sample_triquadratic(float *data, const int res[3], const float co[3]);
+float voxel_sample_tricubic(float *data, const int res[3], const float co[3], int bspline);
#endif /* BLI_VOXEL_H */
diff --git a/source/blender/blenlib/intern/voxel.c b/source/blender/blenlib/intern/voxel.c
index d11386ff606..6d912be71d3 100644
--- a/source/blender/blenlib/intern/voxel.c
+++ b/source/blender/blenlib/intern/voxel.c
@@ -36,7 +36,7 @@
-BM_INLINE float D(float *data, int *res, int x, int y, int z)
+BM_INLINE float D(float *data, const int res[3], int x, int y, int z)
{
CLAMP(x, 0, res[0]-1);
CLAMP(y, 0, res[1]-1);
@@ -46,7 +46,7 @@ BM_INLINE float D(float *data, int *res, int x, int y, int z)
/* *** nearest neighbour *** */
/* input coordinates must be in bounding box 0.0 - 1.0 */
-float voxel_sample_nearest(float *data, int *res, float *co)
+float voxel_sample_nearest(float *data, const int res[3], const float co[3])
{
int xi, yi, zi;
@@ -71,7 +71,7 @@ BM_INLINE int _clamp(int a, int b, int c)
return (a < b) ? b : ((a > c) ? c : a);
}
-float voxel_sample_trilinear(float *data, int *res, float *co)
+float voxel_sample_trilinear(float *data, const int res[3], const float co[3])
{
if (data) {
@@ -103,7 +103,7 @@ float voxel_sample_trilinear(float *data, int *res, float *co)
}
-float voxel_sample_triquadratic(float *data, int *res, float *co)
+float voxel_sample_triquadratic(float *data, const int res[3], const float co[3])
{
if (data) {
@@ -133,7 +133,7 @@ float voxel_sample_triquadratic(float *data, int *res, float *co)
return 0.f;
}
-float voxel_sample_tricubic(float *data, int *res, float *co, int bspline)
+float voxel_sample_tricubic(float *data, const int res[3], const float co[3], int bspline)
{
if (data) {
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 6099331b75b..2bf71586e29 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2144,7 +2144,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
ntreetype->foreach_nodetree(main, NULL, lib_nodetree_init_types_cb);
}
for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
- ntreeInitTypes(ntree);
+ lib_nodetree_init_types_cb(NULL, NULL, ntree);
{
int has_old_groups=0;
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index 2ea10111bb9..ae568e69936 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -577,7 +577,7 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman
case COLLADASW::InputSemantic::OUTPUT:
*length = 1;
if (rotation) {
- values[0] = (bezt->vec[1][1]) * 180.0f/M_PI;
+ values[0] = RAD2DEGF(bezt->vec[1][1]);
}
else {
values[0] = bezt->vec[1][1];
@@ -593,7 +593,7 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman
values[1] = 0;
}
else if (rotation) {
- values[1] = (bezt->vec[0][1]) * 180.0f/M_PI;
+ values[1] = RAD2DEGF(bezt->vec[0][1]);
} else {
values[1] = bezt->vec[0][1];
}
@@ -608,7 +608,7 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman
values[1] = 0;
}
else if (rotation) {
- values[1] = (bezt->vec[2][1]) * 180.0f/M_PI;
+ values[1] = RAD2DEGF(bezt->vec[2][1]);
} else {
values[1] = bezt->vec[2][1];
}
@@ -688,7 +688,7 @@ std::string AnimationExporter::create_source_from_array(COLLADASW::InputSemantic
// val = convert_time(val);
//else
if (is_rot)
- val *= 180.0f / M_PI;
+ val = RAD2DEGF(val);
source.appendValues(val);
}
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index 43428f57d4f..a176b6eb4cd 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -170,9 +170,9 @@ void AnimationImporter::fcurve_deg_to_rad(FCurve *cu)
{
for (unsigned int i = 0; i < cu->totvert; i++) {
// TODO convert handles too
- cu->bezt[i].vec[1][1] *= M_PI / 180.0f;
- cu->bezt[i].vec[0][1] *= M_PI / 180.0f;
- cu->bezt[i].vec[2][1] *= M_PI / 180.0f;
+ cu->bezt[i].vec[1][1] *= DEG2RADF(1.0f);
+ cu->bezt[i].vec[0][1] *= DEG2RADF(1.0f);
+ cu->bezt[i].vec[2][1] *= DEG2RADF(1.0f);
}
}
@@ -741,7 +741,7 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>&
mat4_to_quat(rot, mat);
/*for ( int i = 0 ; i < 4 ; i ++ )
{
- rot[i] = rot[i] * (180 / M_PI);
+ rot[i] = RAD2DEGF(rot[i]);
}*/
copy_v3_v3(loc, mat[3]);
mat4_to_size(scale, mat);
diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp
index 542409072f1..006d4c0ed23 100644
--- a/source/blender/collada/CameraExporter.cpp
+++ b/source/blender/collada/CameraExporter.cpp
@@ -73,7 +73,7 @@ void CamerasExporter::operator()(Object *ob, Scene *sce)
if (cam->type == CAM_PERSP) {
COLLADASW::PerspectiveOptic persp(mSW);
- persp.setXFov(lens_to_angle(cam->lens)*(180.0f/M_PI),"xfov");
+ persp.setXFov(RAD2DEGF(lens_to_angle(cam->lens)), "xfov");
persp.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch),false,"aspect_ratio");
persp.setZFar(cam->clipend, false , "zfar");
persp.setZNear(cam->clipsta,false , "znear");
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index 366837421e3..2387c9a1465 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -816,7 +816,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
double aspect = camera->getAspectRatio().getValue();
double xfov = aspect*yfov;
// xfov is in degrees, cam->lens is in millimiters
- cam->lens = angle_to_lens((float)xfov*(M_PI/180.0f));
+ cam->lens = angle_to_lens(DEG2RADF(xfov));;
}
break;
}
@@ -837,7 +837,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
{
double x = camera->getXFov().getValue();
// x is in degrees, cam->lens is in millimiters
- cam->lens = angle_to_lens((float)x*(M_PI/180.0f));
+ cam->lens = angle_to_lens(DEG2RADF(x));
}
break;
}
@@ -854,7 +854,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
{
double yfov = camera->getYFov().getValue();
// yfov is in degrees, cam->lens is in millimiters
- cam->lens = angle_to_lens((float)yfov*(M_PI/180.0f));
+ cam->lens = angle_to_lens(DEG2RADF(yfov));
}
break;
}
diff --git a/source/blender/collada/TransformReader.cpp b/source/blender/collada/TransformReader.cpp
index 625a0220830..fa14a548850 100644
--- a/source/blender/collada/TransformReader.cpp
+++ b/source/blender/collada/TransformReader.cpp
@@ -82,8 +82,8 @@ void TransformReader::dae_rotate_to_mat4(COLLADAFW::Transformation *tm, float m[
{
COLLADAFW::Rotate *ro = (COLLADAFW::Rotate*)tm;
COLLADABU::Math::Vector3& axis = ro->getRotationAxis();
- float angle = (float)(ro->getRotationAngle() * M_PI / 180.0f);
- float ax[] = {axis[0], axis[1], axis[2]};
+ const float angle = (float)DEG2RAD(ro->getRotationAngle());
+ const float ax[] = {axis[0], axis[1], axis[2]};
// float quat[4];
// axis_angle_to_quat(quat, axis, angle);
// quat_to_mat4(m, quat);
diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp
index 88ed112c3fe..34d13a2184d 100644
--- a/source/blender/collada/TransformWriter.cpp
+++ b/source/blender/collada/TransformWriter.cpp
@@ -107,9 +107,9 @@ void TransformWriter::add_transform(COLLADASW::Node& node, float loc[3], float r
/*node.addRotateZ("rotationZ", COLLADABU::Math::Utils::radToDegF(rot[2]));
node.addRotateY("rotationY", COLLADABU::Math::Utils::radToDegF(rot[1]));
node.addRotateX("rotationX", COLLADABU::Math::Utils::radToDegF(rot[0]));*/
- node.addRotateZ("rotationZ", rot[2] * 180.0f/M_PI);
- node.addRotateY("rotationY", (rot[1]* 180.0f/M_PI));
- node.addRotateX("rotationX", (rot[0]* 180.0f/M_PI));
+ node.addRotateZ("rotationZ", RAD2DEGF(rot[2]));
+ node.addRotateY("rotationY", RAD2DEGF(rot[1]));
+ node.addRotateX("rotationX", RAD2DEGF(rot[0]));
node.addScale("scale", scale[0], scale[1], scale[2]);
}
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);
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index bac1e3cd8ca..4cfd0b56b70 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -103,10 +103,11 @@ typedef struct bNodeSocket {
#define SOCK_FLOAT 0
#define SOCK_VECTOR 1
#define SOCK_RGBA 2
-#define SOCK_INT 3
+#define SOCK_SHADER 3
#define SOCK_BOOLEAN 4
#define SOCK_MESH 5
-#define NUM_SOCKET_TYPES 6 /* must be last! */
+#define SOCK_INT 6
+#define NUM_SOCKET_TYPES 7 /* must be last! */
/* socket side (input/output) */
#define SOCK_IN 1
@@ -123,6 +124,10 @@ typedef struct bNodeSocket {
#define SOCK_DYNAMIC 16
/* group socket should not be exposed */
#define SOCK_INTERNAL 32
+ /* socket collapsed in UI */
+#define SOCK_COLLAPSED 64
+ /* hide socket value, if it gets auto default */
+#define SOCK_HIDE_VALUE 128
typedef struct bNodePreview {
unsigned char *rect;
diff --git a/source/blender/render/intern/include/voxeldata.h b/source/blender/render/intern/include/voxeldata.h
index e9991a2a19c..aa3fd104ecf 100644
--- a/source/blender/render/intern/include/voxeldata.h
+++ b/source/blender/render/intern/include/voxeldata.h
@@ -45,6 +45,6 @@ typedef struct VoxelDataHeader
void make_voxeldata(struct Render *re);
void free_voxeldata(struct Render *re);
-int voxeldatatex(struct Tex *tex, float *texvec, struct TexResult *texres);
+int voxeldatatex(struct Tex *tex, const float texvec[3], struct TexResult *texres);
#endif /* VOXELDATA_H */
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 7ca7a85a7d0..1d11f50a76b 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -822,7 +822,7 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[][4], int d
if(obr->totvert==0) return;
asverts= MEM_callocN(sizeof(ASvert)*obr->totvert, "all smooth verts");
- thresh= cosf((float)M_PI*(0.5f+(float)degr)/180.0f );
+ thresh= cosf(DEG2RADF((0.5f + (float)degr)));
/* step zero: give faces normals of original mesh, if this is provided */
@@ -1717,7 +1717,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
if(part->draw & PART_DRAW_REN_ADAPT) {
sd.adapt = 1;
sd.adapt_pix = (float)part->adapt_pix;
- sd.adapt_angle = cos((float)part->adapt_angle * (float)(M_PI / 180.0));
+ sd.adapt_angle = cosf(DEG2RADF((float)part->adapt_angle));
}
if(re->r.renderer==R_INTERN && part->draw&PART_DRAW_REN_STRAND) {
@@ -1728,7 +1728,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
strandbuf->winx= re->winx;
strandbuf->winy= re->winy;
strandbuf->maxdepth= 2;
- strandbuf->adaptcos= cos((float)part->adapt_angle*(float)(M_PI/180.0));
+ strandbuf->adaptcos= cosf(DEG2RADF((float)part->adapt_angle));
strandbuf->overrideuv= sd.override_uv;
strandbuf->minwidth= ma->strand_min;
diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c
index ad6a951adff..608882e7eb7 100644
--- a/source/blender/render/intern/source/volumetric.c
+++ b/source/blender/render/intern/source/volumetric.c
@@ -186,7 +186,7 @@ static void shade_intersection(ShadeInput *shi, float col_r[4], Isect *is)
col_r[3] = shr_new.alpha;
}
-static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, const float co[3], float col[3])
+static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, const float co[3], float col_r[4])
{
Isect isect;
@@ -204,10 +204,10 @@ static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, const float co[3], f
/* check to see if there's anything behind the volume, otherwise shade the sky */
if(RE_rayobject_raycast(R.raytree, &isect)) {
- shade_intersection(shi, col, &isect);
+ shade_intersection(shi, col_r, &isect);
} else {
- shadeSkyView(col, co, shi->view, NULL, shi->thread);
- shadeSunView(col, shi->view);
+ shadeSkyView(col_r, co, shi->view, NULL, shi->thread);
+ shadeSunView(col_r, shi->view);
}
}
@@ -699,7 +699,7 @@ static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int in
} else {
/* we're tracing through the volume between the camera
* and a solid surface, so use that pre-shaded radiance */
- QUATCOPY(col, shr->combined);
+ copy_v4_v4(col, shr->combined);
}
/* shade volume from 'camera' to 1st hit point */
diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c
index 2ba346ae4c5..b63ece80119 100644
--- a/source/blender/render/intern/source/voxeldata.c
+++ b/source/blender/render/intern/source/voxeldata.c
@@ -383,7 +383,7 @@ void make_voxeldata(struct Render *re)
}
-int voxeldatatex(struct Tex *tex, float *texvec, struct TexResult *texres)
+int voxeldatatex(struct Tex *tex, const float texvec[3], struct TexResult *texres)
{
int retval = TEX_INT;
VoxelData *vd = tex->vd;