svn merge -r40279:40295 ^/trunk/blender
authorCampbell Barton <ideasman42@gmail.com>
Sat, 17 Sep 2011 13:15:38 +0000 (13:15 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 17 Sep 2011 13:15:38 +0000 (13:15 +0000)
37 files changed:
source/blender/blenfont/intern/blf.c
source/blender/blenfont/intern/blf_glyph.c
source/blender/blenfont/intern/blf_internal_types.h
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/effect.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/screen.c
source/blender/blenkernel/intern/seqeffects.c
source/blender/blenlib/BLI_voxel.h
source/blender/blenlib/intern/voxel.c
source/blender/blenloader/intern/readfile.c
source/blender/collada/AnimationExporter.cpp
source/blender/collada/AnimationImporter.cpp
source/blender/collada/CameraExporter.cpp
source/blender/collada/DocumentImporter.cpp
source/blender/collada/TransformReader.cpp
source/blender/collada/TransformWriter.cpp
source/blender/editors/animation/anim_draw.c
source/blender/editors/armature/editarmature.c
source/blender/editors/interface/interface_draw.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_stroke.c
source/blender/editors/space_action/action_edit.c
source/blender/editors/space_action/action_select.c
source/blender/editors/space_console/console_ops.c
source/blender/editors/space_graph/graph_edit.c
source/blender/editors/space_graph/graph_select.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/editors/uvedit/uvedit_draw.c
source/blender/makesdna/DNA_node_types.h
source/blender/render/intern/include/voxeldata.h
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/volumetric.c
source/blender/render/intern/source/voxeldata.c
source/gameengine/Ketsji/KX_Dome.cpp

index fc812d652b3da257f890fdb76cccdcb4935aa47d..577697de59499e492c95487c33f6fc6b5152d7e6 100644 (file)
@@ -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)
index 9b39cb65cba607058c1f3f78beadef10924b0090..7a1fa8c80b07aaee7121fd72d1721416fee81fb6 100644 (file)
@@ -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);
 }
index 9840e6446ef1c53be327d7adaf62dafefabf22ef..1450ad39ad815534ea02778bf3e9252610ed206b 100644 (file)
@@ -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;
 
index e847e0961effaa16f85271f6e7444cb9b63f009e..7472e03d6d1847602423872d2f3f3fde2e339267 100644 (file)
@@ -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]);
index 3c693fd83a45d408e516876887b1808b4d18e3b8..c0d2eca9217c9b3f5e2b8599edbe7b2a64f4f8e4 100644 (file)
@@ -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);
index c4a984773809ccc622045f2927e52d727e6d81cc..500d4ae13f7f6278be0778769b193e72b3edea0d 100644 (file)
@@ -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;
index 414261547d7319170afdcb7b380e6f116cb58805..ad870bb0bb88767adf0c1af4a131c2365a53fe91 100644 (file)
@@ -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)
index 50b3e32278aff7cc60f594cbe36f7d678e31a700..ef1b75e59138a8fcf254abf20caa1419c8f8fcee 100644 (file)
@@ -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 */
index 43747fde72913d7260664753e4067c5193372339..e5d74177c9156df1c2d5ca02627853438b7fe03a 100644 (file)
@@ -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);
 }
index 41f8bfab7295869543440e6261fb35aa265f5a90..8dd95a897ae691453def2bdbcd8050680180cec2 100644 (file)
@@ -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 */
index d11386ff6069296fa732c1c8c524b8d81c6a43c8..6d912be71d3e82cab30f63ccd1e303f43f243bb7 100644 (file)
@@ -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) {
 
index 6099331b75be2cedcd0c7db99c4b12be9514a4cd..2bf71586e295ea2546cd17662de9379ed16e060e 100644 (file)
@@ -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;
index 2ea10111bb94b17951a82e21ea8695d22c25a804..ae568e69936ffce8366f18c36ba81f9fe8ded937 100644 (file)
@@ -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);
        }
 
index 43428f57d4f92ffd61393e2f6a3b94dae8a63772..a176b6eb4cd4da8f124c670b2becfdf131153132 100644 (file)
@@ -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);
index 542409072f15fa9e39409c2f804c42f90b28b335..006d4c0ed23f4a39656a28939679ee86fdca1c92 100644 (file)
@@ -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");
index 366837421e3173872b691808fdff7cd7d9d082d1..2387c9a1465c3b6b42bf27570c871e7d41b9d33a 100644 (file)
@@ -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;
                        }
index 625a0220830c9ff62f510fcf0334a47f022b8b7d..fa14a548850bcb7a40f760806599131b844b388d 100644 (file)
@@ -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);
index 88ed112c3fe3a22926d425bf303a62b57e5c0f57..34d13a2184d2fa8c72d4c07002efa26d1d89aac2 100644 (file)
@@ -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]);
 }
index 709743869177cf3c05040084acc1d8b6fb1e553d..d2b1fcc4abdab68271291831a069a7e46ae2ea94 100644 (file)
@@ -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 */
                                }
                        }
                        
index 77ab97b4d57340edef196dddde3ba3002ead451a..1cec23b890ef5e65ae6808c21ecf36fc7a4b985e 100644 (file)
@@ -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]);
                        
index 33aeb2df926a62f0c4b06f6e16445f19dd52d0a1..8889c419c35bd7a92e041f163d60fc36c357083b 100644 (file)
@@ -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 */
index 8da693a5166017525a71c1ea6735308cb1f5f05b..9d65e8004d7ffcc654a2efa220b6af3043b164b9 100644 (file)
@@ -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])
index 73a6e4fad201d71b1cb3f0998b182d9f4332ddbc..767001ff1637de654ec6e90f8683babc72dd1a55 100644 (file)
@@ -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 */
index b5dfdcdc668133a2348c77890e32288750d6846e..60662334e20465d7df086dc55f5c6de901b0bf6d 100644 (file)
@@ -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 ************************* */
index aa29e54f4366739dbeb0aaf39bf4ed343e160bb5..32594e710a4f85c9b41b4c3d4f9880dc9154656d 100644 (file)
@@ -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;
index 4707baa279bc55a3009d027b837a060fcaf8201d..85cf30dfeba42a4271a1fffa65e2d24f60407e66 100644 (file)
@@ -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");
 }
 
 
index 900aa6f619705cd104d6cc4f76a79f0a903c16cb..f115fd93c2e42f2cff5b6e07ee2cd664b3307205 100644 (file)
@@ -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 ************************* */
index b8c5d79df184563d6d616c4acaae3dc361a60b61..40380db03d46a585300b1a3e399fce71f8a081a8 100644 (file)
@@ -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;
index f3ccf7964930679baa499c9b29f5983ccd8df2b1..4e185d6603aa183823aca0d3c2ff812703c5781a 100644 (file)
@@ -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)){
index ec3e6ea93bdef1db67f4e49654295d2d77a79f1f..d2cb2a6c46f76baec1005060c2a1a2fe9893f189 100644 (file)
@@ -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];
index 45bfb7ca17d7497b3932d0c59b87a3df845eb310..e8660022a8bbdaffbbaecbcadbd53a9d0b7d987f 100644 (file)
@@ -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);
index bac1e3cd8cac594d847cd3958a84e73902667c34..4cfd0b56b70d3816a40478aac47974e0e93c0882 100644 (file)
@@ -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;
index e9991a2a19c8108ab1547ed93ac8f7ee1c11577e..aa3fd104ecf1f875efa55d50340a0f6a2a181890 100644 (file)
@@ -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 */
index 7ca7a85a7d036d79b9822426d1bf0d9186461830..1d11f50a76b805ce4e6055fd3a261e40a02408ca 100644 (file)
@@ -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;
 
index ad6a951adff33d23bf6381dac50513aebf97c7d8..608882e7eb7f754678cbdf59be4552c9cbe23ee7 100644 (file)
@@ -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 */
index 2ba346ae4c51ffdfa87206a2d302b9cd7d16d806..b63ece801194897ecdb5ff20d2bcbb50ae7e3ca4 100644 (file)
@@ -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;        
index 00c5e5803a828eae6cf08a53121ddbfe848645f0..f0ea6f15ffe33942af2b0dd4d198baad60da19ed 100644 (file)
@@ -561,7 +561,7 @@ void KX_Dome::CreateMeshDome180(void)
        int i,j;
        float uv_ratio = (float)(m_buffersize-1) / m_imagesize;
 
-       m_radangle = m_angle * M_PI/180.0;//calculates the radians angle, used for flattening
+       m_radangle = DEG2RADF(m_angle); //calculates the radians angle, used for flattening
 
        //creating faces for the env mapcube 180deg Dome
        // Top Face - just a triangle