diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-09-11 12:28:16 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-09-11 12:28:16 +0400 |
commit | 0383fb53414366d4ede19622fbe5bb5e6f782a0f (patch) | |
tree | f9137000aeb86b710773e41743671e70f44b4463 /source/blender | |
parent | 75b393612809252349bf4062bc45df14c1a5dfe5 (diff) | |
parent | ff04beb3e4681e6849030595c80ed692c3bd9be1 (diff) |
svn merge -r40104:40117 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/blender')
49 files changed, 593 insertions, 596 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index fb6505fe935..52aace1d3d7 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -97,14 +97,52 @@ void blf_font_size(FontBLF *font, int size, int dpi) } } +static void blf_font_ensure_ascii_table(FontBLF *font) +{ + /* build ascii on demand */ + if(font->glyph_ascii_table['0']==NULL) { + GlyphBLF *g; + unsigned int i; + for(i=0; i<256; i++) { + g= blf_glyph_search(font->glyph_cache, i); + if (!g) { + FT_UInt glyph_index= FT_Get_Char_Index(font->face, i); + g= blf_glyph_add(font, glyph_index, i); + } + font->glyph_ascii_table[i]= g; + } + } +} + +/* Fast path for runs of ASCII characters. Given that common UTF-8 + * input will consist of an overwhelming majority of ASCII + * characters. + */ + +/* Note, + * blf_font_ensure_ascii_table(font); must be called before this macro */ + +#define BLF_UTF8_NEXT_FAST(font, g, str, i, c) \ + if(((c)= (str)[i]) < 0x80) { \ + g= (font)->glyph_ascii_table[c]; \ + i++; \ + } \ + else if ((c= blf_utf8_next((unsigned char *)(str), &(i)))) { \ + if ((g= blf_glyph_search((font)->glyph_cache, c)) == NULL) { \ + g= blf_glyph_add(font, FT_Get_Char_Index((font)->face, c), c); \ + } \ + } \ + + + void blf_font_draw(FontBLF *font, const char *str, unsigned int len) { unsigned int c; GlyphBLF *g, *g_prev; FT_Vector delta; - FT_UInt glyph_index; int pen_x, pen_y; - int i, has_kerning, st; + int has_kerning, st; + unsigned int i; if (!font->glyph_cache) return; @@ -115,17 +153,15 @@ void blf_font_draw(FontBLF *font, const char *str, unsigned int len) has_kerning= FT_HAS_KERNING(font->face); g_prev= NULL; + blf_font_ensure_ascii_table(font); + while (str[i] && i < len) { - c= blf_utf8_next((unsigned char *)str, &i); + + BLF_UTF8_NEXT_FAST(font, g, str, i, c); + if (c == 0) break; - g= blf_glyph_search(font->glyph_cache, c); - if (!g) { - glyph_index= FT_Get_Char_Index(font->face, c); - g= blf_glyph_add(font, glyph_index, c); - } - /* if we don't found a glyph, skip it. */ if (!g) continue; @@ -157,9 +193,8 @@ void blf_font_draw_ascii(FontBLF *font, const char *str, unsigned int len) char c; GlyphBLF *g, *g_prev; FT_Vector delta; - FT_UInt glyph_index; int pen_x, pen_y; - int i, has_kerning, st; + int has_kerning, st; if (!font->glyph_cache) return; @@ -169,18 +204,8 @@ void blf_font_draw_ascii(FontBLF *font, const char *str, unsigned int len) has_kerning= FT_HAS_KERNING(font->face); g_prev= NULL; - /* build ascii on demand */ - if(font->glyph_ascii_table['0']==NULL) { - for(i=0; i<256; i++) { - g= blf_glyph_search(font->glyph_cache, i); - if (!g) { - glyph_index= FT_Get_Char_Index(font->face, i); - g= blf_glyph_add(font, glyph_index, i); - } - font->glyph_ascii_table[i]= g; - } - } - + blf_font_ensure_ascii_table(font); + while ((c= *(str++)) && len--) { g= font->glyph_ascii_table[c]; @@ -216,10 +241,10 @@ void blf_font_buffer(FontBLF *font, const char *str) unsigned char b_col_char[4]; GlyphBLF *g, *g_prev; FT_Vector delta; - FT_UInt glyph_index; float a, *fbuf; int pen_x, y, x; - int i, has_kerning, st, chx, chy; + int has_kerning, st, chx, chy; + unsigned int i; if (!font->glyph_cache || (!font->b_fbuf && !font->b_cbuf)) return; @@ -234,18 +259,16 @@ void blf_font_buffer(FontBLF *font, const char *str) b_col_char[2]= font->b_col[2] * 255; b_col_char[3]= font->b_col[3] * 255; + blf_font_ensure_ascii_table(font); + while (str[i]) { int pen_y; - c= blf_utf8_next((unsigned char *)str, &i); + + BLF_UTF8_NEXT_FAST(font, g, str, i, c); + if (c == 0) break; - g= blf_glyph_search(font->glyph_cache, c); - if (!g) { - glyph_index= FT_Get_Char_Index(font->face, c); - g= blf_glyph_add(font, glyph_index, c); - } - /* if we don't found a glyph, skip it. */ if (!g) continue; @@ -363,10 +386,10 @@ void blf_font_boundbox(FontBLF *font, const char *str, rctf *box) unsigned int c; GlyphBLF *g, *g_prev; FT_Vector delta; - FT_UInt glyph_index; rctf gbox; int pen_x, pen_y; - int i, has_kerning, st; + int has_kerning, st; + unsigned int i; if (!font->glyph_cache) return; @@ -382,17 +405,15 @@ void blf_font_boundbox(FontBLF *font, const char *str, rctf *box) has_kerning= FT_HAS_KERNING(font->face); g_prev= NULL; + blf_font_ensure_ascii_table(font); + while (str[i]) { - c= blf_utf8_next((unsigned char *)str, &i); + + BLF_UTF8_NEXT_FAST(font, g, str, i, c); + if (c == 0) break; - g= blf_glyph_search(font->glyph_cache, c); - if (!g) { - glyph_index= FT_Get_Char_Index(font->face, c); - g= blf_glyph_add(font, glyph_index, c); - } - /* if we don't found a glyph, skip it. */ if (!g) continue; @@ -534,7 +555,7 @@ void blf_font_free(FontBLF *font) static void blf_font_fill(FontBLF *font) { - int i; + unsigned int i; font->aspect[0]= 1.0f; font->aspect[1]= 1.0f; diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h index 9271d8d5a9e..ba0b9985dd4 100644 --- a/source/blender/blenfont/intern/blf_internal.h +++ b/source/blender/blenfont/intern/blf_internal.h @@ -40,7 +40,7 @@ struct rctf; unsigned int blf_next_p2(unsigned int x); unsigned int blf_hash(unsigned int val); -int blf_utf8_next(unsigned char *buf, int *iindex); +int blf_utf8_next(unsigned char *buf, unsigned int *iindex); char *blf_dir_search(const char *file); char *blf_dir_metrics_search(const char *filename); diff --git a/source/blender/blenfont/intern/blf_util.c b/source/blender/blenfont/intern/blf_util.c index ab6b516787e..edd23ac1ba6 100644 --- a/source/blender/blenfont/intern/blf_util.c +++ b/source/blender/blenfont/intern/blf_util.c @@ -72,7 +72,7 @@ unsigned int blf_hash(unsigned int val) * The original name: imlib_font_utf8_get_next * more info here: http://docs.enlightenment.org/api/imlib2/html/ */ -int blf_utf8_next(unsigned char *buf, int *iindex) +int blf_utf8_next(unsigned char *buf, unsigned int *iindex) { /* Reads UTF8 bytes from 'buf', starting at 'index' and * returns the code point of the next valid code point. diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h index 744ed9dba9c..5b40fa5d758 100644 --- a/source/blender/blenkernel/BKE_colortools.h +++ b/source/blender/blenkernel/BKE_colortools.h @@ -55,7 +55,7 @@ void floatbuf_to_byte(float *rectf, unsigned char *rectc, int x1, int x2, int struct CurveMapping *curvemapping_add(int tot, float minx, float miny, float maxx, float maxy); void curvemapping_free(struct CurveMapping *cumap); struct CurveMapping *curvemapping_copy(struct CurveMapping *cumap); -void curvemapping_set_black_white(struct CurveMapping *cumap, float *black, float *white); +void curvemapping_set_black_white(struct CurveMapping *cumap, const float black[3], const float white[3]); #define CURVEMAP_SLOPE_NEGATIVE 0 #define CURVEMAP_SLOPE_POSITIVE 1 @@ -70,9 +70,9 @@ void curvemapping_changed(struct CurveMapping *cumap, int rem_doubles); float curvemap_evaluateF(struct CurveMap *cuma, float value); /* single curve, with table check */ float curvemapping_evaluateF(struct CurveMapping *cumap, int cur, float value); -void curvemapping_evaluate3F(struct CurveMapping *cumap, float *vecout, const float *vecin); -void curvemapping_evaluateRGBF(struct CurveMapping *cumap, float *vecout, const float *vecin); -void curvemapping_evaluate_premulRGBF(struct CurveMapping *cumap, float *vecout, const float *vecin); +void curvemapping_evaluate3F(struct CurveMapping *cumap, float vecout[3], const float vecin[3]); +void curvemapping_evaluateRGBF(struct CurveMapping *cumap, float vecout[3], const float vecin[3]); +void curvemapping_evaluate_premulRGBF(struct CurveMapping *cumap, float vecout[3], const float vecin[3]); void curvemapping_do_ibuf(struct CurveMapping *cumap, struct ImBuf *ibuf); void curvemapping_premultiply(struct CurveMapping *cumap, int restore); int curvemapping_RGBA_does_something(struct CurveMapping *cumap); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index c497cd2813a..c84a3cfc730 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -555,7 +555,7 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int bufsize, ImBuf if (texfall == 0) { dist = sqrt(xy[0]*xy[0] + xy[1]*xy[1]); - VECCOPY(dstf, brush_rgb); + copy_v3_v3(dstf, brush_rgb); dstf[3]= alpha*brush_curve_strength_clamp(brush, dist, radius); } else if (texfall == 1) { @@ -754,7 +754,7 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, i for (x=origx; x < w; x++, bf+=4, mf+=4, tf+=4) { if (dotexold) { - VECCOPY(tf, otf); + copy_v3_v3(tf, otf); tf[3] = otf[3]; otf += 4; } @@ -926,7 +926,7 @@ static void brush_apply_pressure(BrushPainter *painter, Brush *brush, float pres brush->spacing = MAX2(1.0f, painter->startspacing*(1.5f-pressure)); } -void brush_jitter_pos(Brush *brush, float *pos, float *jitterpos) +void brush_jitter_pos(Brush *brush, float pos[2], float jitterpos[2]) { int use_jitter= brush->jitter != 0; @@ -949,7 +949,7 @@ void brush_jitter_pos(Brush *brush, float *pos, float *jitterpos) jitterpos[1] = pos[1] + 2*rand_pos[1]*diameter*brush->jitter; } else { - VECCOPY2D(jitterpos, pos); + copy_v2_v2(jitterpos, pos); } } diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 9a6c2cc7e31..61e9daf4138 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -167,14 +167,14 @@ CurveMapping *curvemapping_copy(CurveMapping *cumap) return NULL; } -void curvemapping_set_black_white(CurveMapping *cumap, float *black, float *white) +void curvemapping_set_black_white(CurveMapping *cumap, const float black[3], const float white[3]) { int a; if(white) - VECCOPY(cumap->white, white); + copy_v3_v3(cumap->white, white); if(black) - VECCOPY(cumap->black, black); + copy_v3_v3(cumap->black, black); for(a=0; a<3; a++) { if(cumap->white[a]==cumap->black[a]) @@ -432,7 +432,7 @@ static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *nex /* in X, out Y. X is presumed to be outside first or last */ -static float curvemap_calc_extend(CurveMap *cuma, float x, float *first, float *last) +static float curvemap_calc_extend(CurveMap *cuma, float x, const float first[2], const float last[2]) { if(x <= first[0]) { if((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0) { @@ -753,7 +753,7 @@ float curvemapping_evaluateF(CurveMapping *cumap, int cur, float value) } /* vector case */ -void curvemapping_evaluate3F(CurveMapping *cumap, float *vecout, const float *vecin) +void curvemapping_evaluate3F(CurveMapping *cumap, float vecout[3], const float vecin[3]) { vecout[0]= curvemapping_evaluateF(cumap, 0, vecin[0]); vecout[1]= curvemapping_evaluateF(cumap, 1, vecin[1]); @@ -761,7 +761,7 @@ void curvemapping_evaluate3F(CurveMapping *cumap, float *vecout, const float *ve } /* RGB case, no black/white points, no premult */ -void curvemapping_evaluateRGBF(CurveMapping *cumap, float *vecout, const float *vecin) +void curvemapping_evaluateRGBF(CurveMapping *cumap, float vecout[3], const float vecin[3]) { vecout[0]= curvemapping_evaluateF(cumap, 0, curvemapping_evaluateF(cumap, 3, vecin[0])); vecout[1]= curvemapping_evaluateF(cumap, 1, curvemapping_evaluateF(cumap, 3, vecin[1])); @@ -770,7 +770,7 @@ void curvemapping_evaluateRGBF(CurveMapping *cumap, float *vecout, const float * /* RGB with black/white points and premult. tables are checked */ -void curvemapping_evaluate_premulRGBF(CurveMapping *cumap, float *vecout, const float *vecin) +void curvemapping_evaluate_premulRGBF(CurveMapping *cumap, float vecout[3], const float vecin[3]) { float fac; diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 836aaa0d169..b8820fb24d1 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2548,9 +2548,9 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode) sub_v3_v3v3(h2, p2, p2+3); len1= normalize_v3(h1); len2= normalize_v3(h2); - - vz= INPR(h1, h2); - + + vz= dot_v3v3(h1, h2); + if(leftviolate) { *(p2+3)= *(p2) - vz*len2*h1[0]; *(p2+4)= *(p2+1) - vz*len2*h1[1]; diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index fcdf30be992..362722ea191 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -136,16 +136,6 @@ static void space_transform_invert_normal(const SpaceTransform *data, float *no) } /* - * Returns the squared distance between two given points - */ -static float squared_dist(const float *a, const float *b) -{ - float tmp[3]; - VECSUB(tmp, a, b); - return INPR(tmp, tmp); -} - -/* * Shrinkwrap to the nearest vertex * * it builds a kdtree of vertexs we can attach to and then @@ -197,7 +187,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc) //so we can initiate the "nearest.dist" with the expected value to that last hit. //This will lead in prunning of the search tree. if(nearest.index != -1) - nearest.dist = squared_dist(tmp_co, nearest.co); + nearest.dist = len_squared_v3v3(tmp_co, nearest.co); else nearest.dist = FLT_MAX; @@ -330,7 +320,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc) normalize_v3(proj_axis); //Invalid projection direction - if(INPR(proj_axis, proj_axis) < FLT_EPSILON) + if(dot_v3v3(proj_axis, proj_axis) < FLT_EPSILON) return; } @@ -471,7 +461,7 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc) //so we can initiate the "nearest.dist" with the expected value to that last hit. //This will lead in prunning of the search tree. if(nearest.index != -1) - nearest.dist = squared_dist(tmp_co, nearest.co); + nearest.dist = len_squared_v3v3(tmp_co, nearest.co); else nearest.dist = FLT_MAX; diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index dcbe043f0d0..eae4f918a67 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -408,7 +408,7 @@ static void create_kdop_hull(BVHTree *tree, BVHNode *node, float *co, int numpoi // for all Axes. for (i = tree->start_axis; i < tree->stop_axis; i++) { - newminmax = INPR(&co[k * 3], KDOP_AXES[i]); + newminmax = dot_v3v3(&co[k * 3], KDOP_AXES[i]); if (newminmax < bv[2 * i]) bv[2 * i] = newminmax; if (newminmax > bv[(2 * i) + 1]) @@ -1193,17 +1193,6 @@ BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int return overlap; } - -/* - * Nearest neighbour - BLI_bvhtree_find_nearest - */ -static float squared_dist(const float *a, const float *b) -{ - float tmp[3]; - VECSUB(tmp, a, b); - return INPR(tmp, tmp); -} - //Determines the nearest point of the given node BV. Returns the squared distance to that point. static float calc_nearest_point(const float *proj, BVHNode *node, float *nearest) { @@ -1226,7 +1215,7 @@ static float calc_nearest_point(const float *proj, BVHNode *node, float *nearest VECCOPY(nearest, data->co); for(i = data->tree->start_axis; i != data->tree->stop_axis; i++, bv+=2) { - float proj = INPR( nearest, KDOP_AXES[i]); + float proj = dot_v3v3( nearest, KDOP_AXES[i]); float dl = bv[0] - proj; float du = bv[1] - proj; @@ -1240,7 +1229,7 @@ static float calc_nearest_point(const float *proj, BVHNode *node, float *nearest } } */ - return squared_dist(proj, nearest); + return len_squared_v3v3(proj, nearest); } @@ -1404,7 +1393,7 @@ int BLI_bvhtree_find_nearest(BVHTree *tree, const float *co, BVHTreeNearest *nea for(i = data.tree->start_axis; i != data.tree->stop_axis; i++) { - data.proj[i] = INPR(data.co, KDOP_AXES[i]); + data.proj[i] = dot_v3v3(data.co, KDOP_AXES[i]); } if(nearest) @@ -1596,7 +1585,7 @@ int BLI_bvhtree_ray_cast(BVHTree *tree, const float *co, const float *dir, float for(i=0; i<3; i++) { - data.ray_dot_axis[i] = INPR( data.ray.direction, KDOP_AXES[i]); + data.ray_dot_axis[i] = dot_v3v3(data.ray.direction, KDOP_AXES[i]); data.idot_axis[i] = 1.0f / data.ray_dot_axis[i]; if(fabsf(data.ray_dot_axis[i]) < FLT_EPSILON) diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index bdc654ff25a..276765bf96e 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -121,7 +121,7 @@ static void acf_generic_root_backdrop(bAnimContext *ac, bAnimListElem *ale, floa glColor3fv(color); /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */ - uiSetRoundBox((expanded)? (1):(1|8)); + uiSetRoundBox(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)); uiDrawBox(GL_POLYGON, offset, yminc, v2d->cur.xmax+EXTRA_SCROLL_PAD, ymaxc, 8); } @@ -401,7 +401,7 @@ static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float ymi * - top and bottom * - special hack: make the top a bit higher, since we are first... */ - uiSetRoundBox((1|8)); + uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT); uiDrawBox(GL_POLYGON, 0, yminc-2, v2d->cur.xmax+EXTRA_SCROLL_PAD, ymaxc, 8); } @@ -756,7 +756,7 @@ static void acf_group_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc glColor3fv(color); /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */ - uiSetRoundBox((expanded)? (1):(1|8)); + uiSetRoundBox(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)); uiDrawBox(GL_POLYGON, offset, yminc, v2d->cur.xmax+EXTRA_SCROLL_PAD, ymaxc, 8); } diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 41733bcd29a..218bd411f06 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -518,7 +518,7 @@ static float heat_source_distance(LaplacianSystem *sys, int vertex, int source) dist= normalize_v3(d); /* if the vertex normal does not point along the bone, increase distance */ - cosine= INPR(d, sys->heat.vnors[vertex]); + cosine= dot_v3v3(d, sys->heat.vnors[vertex]); return dist/(0.5f*(cosine + 1.001f)); } @@ -1124,7 +1124,7 @@ static int meshdeform_tri_intersect(float orig[3], float end[3], float vert0[3], cross_v3_v3v3(pvec, dir, edge2); /* if determinant is near zero, ray lies in plane of triangle */ - det = INPR(edge1, pvec); + det = dot_v3v3(edge1, pvec); if (det == 0.0f) return 0; @@ -1134,7 +1134,7 @@ static int meshdeform_tri_intersect(float orig[3], float end[3], float vert0[3], sub_v3_v3v3(tvec, orig, vert0); /* calculate U parameter and test bounds */ - u = INPR(tvec, pvec) * inv_det; + u = dot_v3v3(tvec, pvec) * inv_det; if (u < -EPSILON || u > 1.0f+EPSILON) return 0; @@ -1142,7 +1142,7 @@ static int meshdeform_tri_intersect(float orig[3], float end[3], float vert0[3], cross_v3_v3v3(qvec, tvec, edge1); /* calculate V parameter and test bounds */ - v = INPR(dir, qvec) * inv_det; + v = dot_v3v3(dir, qvec) * inv_det; if (v < -EPSILON || u + v > 1.0f+EPSILON) return 0; @@ -1157,10 +1157,10 @@ static int meshdeform_tri_intersect(float orig[3], float end[3], float vert0[3], /* check if it is within the length of the line segment */ sub_v3_v3v3(isectdir, isectco, orig); - if(INPR(dir, isectdir) < -EPSILON) + if(dot_v3v3(dir, isectdir) < -EPSILON) return 0; - if(INPR(dir, dir) + EPSILON < INPR(isectdir, isectdir)) + if(dot_v3v3(dir, dir) + EPSILON < dot_v3v3(isectdir, isectdir)) return 0; return 1; @@ -1206,7 +1206,7 @@ static int meshdeform_intersect(MeshDeformBind *mdb, MeshDeformIsect *isec) if(len < isec->labda) { isec->labda= len; isec->face = mface; - isec->isect= (INPR(isec->vec, nor) <= 0.0f); + isec->isect= (dot_v3v3(isec->vec, nor) <= 0.0f); is= 1; } } diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 3fe012ea73e..637940f59a6 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -653,6 +653,25 @@ void UI_exit(void); #define UI_LAYOUT_OP_SHOW_TITLE 1 #define UI_LAYOUT_OP_SHOW_EMPTY 2 +/* flags to set which corners will become rounded: + * + * 1------2 + * | | + * 8------4 */ + +enum { + UI_CNR_TOP_LEFT= 1, + UI_CNR_TOP_RIGHT= 2, + UI_CNR_BOTTOM_RIGHT= 4, + UI_CNR_BOTTOM_LEFT= 8, + /* just for convenience */ + UI_CNR_NONE= 0, + UI_CNR_ALL= (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT) +}; + +/* not apart of the corner flags but mixed in some functions */ +#define UI_RB_ALPHA (UI_CNR_ALL + 1) + uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int size, int em, struct uiStyle *style); void uiBlockSetCurLayout(uiBlock *block, uiLayout *layout); void uiBlockLayoutResolve(uiBlock *block, int *x, int *y); diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index d383bc0ab78..ab5b8e8aff3 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -296,6 +296,9 @@ void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4]); // blends and shades between two color pointers void UI_ColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], float fac, int offset); +// shade a 3 byte color (same as UI_GetColorPtrBlendShade3ubv with 0.0 factor) +void UI_GetColorPtrShade3ubv(const unsigned char cp1[3], unsigned char col[3], int offset); + // get a 3 byte color, blended and shaded between two other char color pointers void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], float fac, int offset); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 2267f04aab4..33aeb2df926 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -58,10 +58,9 @@ /* own include */ #include "interface_intern.h" -#define UI_RB_ALPHA 16 #define UI_DISABLED_ALPHA_OFFS -160 -static int roundboxtype= 15; +static int roundboxtype= UI_CNR_ALL; void uiSetRoundBox(int type) { @@ -69,13 +68,6 @@ void uiSetRoundBox(int type) * if this is undone, its not that big a deal, only makes curves edges * square for the */ roundboxtype= type; - - /* flags to set which corners will become rounded: - - 1------2 - | | - 8------4 - */ } @@ -98,7 +90,7 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r glBegin(mode); /* start with corner right-bottom */ - if(roundboxtype & 4) { + if(roundboxtype & UI_CNR_BOTTOM_RIGHT) { glVertex2f(maxx-rad, miny); for(a=0; a<7; a++) { glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]); @@ -108,7 +100,7 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r else glVertex2f(maxx, miny); /* corner right-top */ - if(roundboxtype & 2) { + if(roundboxtype & UI_CNR_TOP_RIGHT) { glVertex2f(maxx, maxy-rad); for(a=0; a<7; a++) { glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]); @@ -118,7 +110,7 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r else glVertex2f(maxx, maxy); /* corner left-top */ - if(roundboxtype & 1) { + if(roundboxtype & UI_CNR_TOP_LEFT) { glVertex2f(minx+rad, maxy); for(a=0; a<7; a++) { glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]); @@ -128,7 +120,7 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r else glVertex2f(minx, maxy); /* corner left-bottom */ - if(roundboxtype & 8) { + if(roundboxtype & UI_CNR_BOTTOM_LEFT) { glVertex2f(minx, miny+rad); for(a=0; a<7; a++) { glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]); @@ -180,7 +172,7 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl glBegin(mode); /* start with corner right-bottom */ - if(roundboxtype & 4) { + if(roundboxtype & UI_CNR_BOTTOM_RIGHT) { round_box_shade_col(coltop, coldown, 0.0); glVertex2f(maxx-rad, miny); @@ -199,7 +191,7 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl } /* corner right-top */ - if(roundboxtype & 2) { + if(roundboxtype & UI_CNR_TOP_RIGHT) { round_box_shade_col(coltop, coldown, (div-rad)*idiv); glVertex2f(maxx, maxy-rad); @@ -217,7 +209,7 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl } /* corner left-top */ - if(roundboxtype & 1) { + if(roundboxtype & UI_CNR_TOP_LEFT) { round_box_shade_col(coltop, coldown, 1.0); glVertex2f(minx+rad, maxy); @@ -236,7 +228,7 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl } /* corner left-bottom */ - if(roundboxtype & 8) { + if(roundboxtype & UI_CNR_BOTTOM_LEFT) { round_box_shade_col(coltop, coldown, rad*idiv); glVertex2f(minx, miny+rad); @@ -288,7 +280,7 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float glBegin(mode); /* start with corner right-bottom */ - if(roundboxtype & 4) { + if(roundboxtype & UI_CNR_BOTTOM_RIGHT) { round_box_shade_col(colLeft, colRight, 0.0); glVertex2f(maxx-rad, miny); @@ -306,7 +298,7 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float } /* corner right-top */ - if(roundboxtype & 2) { + if(roundboxtype & UI_CNR_TOP_RIGHT) { round_box_shade_col(colLeft, colRight, 0.0); glVertex2f(maxx, maxy-rad); @@ -324,7 +316,7 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float } /* corner left-top */ - if(roundboxtype & 1) { + if(roundboxtype & UI_CNR_TOP_LEFT) { round_box_shade_col(colLeft, colRight, (div-rad)*idiv); glVertex2f(minx+rad, maxy); @@ -342,7 +334,7 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float } /* corner left-bottom */ - if(roundboxtype & 8) { + if(roundboxtype & UI_CNR_BOTTOM_LEFT) { round_box_shade_col(colLeft, colRight, 1.0); glVertex2f(minx, miny+rad); @@ -709,7 +701,7 @@ static void draw_scope_end(rctf *rect, GLint *scissor) /* outline */ glColor4f(0.f, 0.f, 0.f, 0.5f); - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); uiDrawBox(GL_LINE_LOOP, rect->xmin-1, rect->ymin, rect->xmax+1, rect->ymax+1, 3.0f); } @@ -768,7 +760,7 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol) glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glColor4f(0.f, 0.f, 0.f, 0.3f); - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f); /* need scissor test, histogram can draw outside of boundary */ @@ -837,7 +829,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glColor4f(0.f, 0.f, 0.f, 0.3f); - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f); @@ -1048,7 +1040,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glColor4f(0.f, 0.f, 0.f, 0.3f); - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f); /* need scissor test, hvectorscope can draw outside of boundary */ @@ -1233,7 +1225,7 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect) /* backdrop */ glColor3ubv((unsigned char*)wcol->inner); - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); uiDrawBox(GL_POLYGON, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 5.0f); /* sphere color */ diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 3b20533dcd4..cd1d250d6a4 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -537,8 +537,8 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) /* in some occasions, draw a border */ if(panel->flag & PNL_SELECT) { - if(panel->control & UI_PNL_SOLID) uiSetRoundBox(15); - else uiSetRoundBox(3); + if(panel->control & UI_PNL_SOLID) uiSetRoundBox(UI_CNR_ALL); + else uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); UI_ThemeColorShade(TH_BACK, -120); uiRoundRect(0.5f + rect->xmin, 0.5f + rect->ymin, 0.5f + rect->xmax, 0.5f + headrect.ymax+1, 8); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index d9d75c34a94..c36742f7c4d 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -90,15 +90,6 @@ typedef struct uiWidgetTrias { #define WIDGET_CURVE_RESOLU 9 #define WIDGET_SIZE_MAX (WIDGET_CURVE_RESOLU*4) -enum { - WIDGET_TOP_LEFT= 1, - WIDGET_TOP_RIGHT= 2, - WIDGET_BOTTOM_RIGHT= 4, - WIDGET_BOTTOM_LEFT= 8, - /* just for convenience */ - WIDGET_ALL_CORNERS= (WIDGET_TOP_LEFT | WIDGET_TOP_RIGHT | WIDGET_BOTTOM_RIGHT | WIDGET_BOTTOM_LEFT) -}; - typedef struct uiWidgetBase { int totvert, halfwayvert; @@ -249,7 +240,7 @@ static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int r } /* start with left-top, anti clockwise */ - if(roundboxalign & WIDGET_TOP_LEFT) { + if(roundboxalign & UI_CNR_TOP_LEFT) { for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) { vert[tot][0]= minx+rad-vec[a][0]; vert[tot][1]= maxy-vec[a][1]; @@ -262,7 +253,7 @@ static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int r } } - if(roundboxalign & WIDGET_BOTTOM_LEFT) { + if(roundboxalign & UI_CNR_BOTTOM_LEFT) { for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) { vert[tot][0]= minx+vec[a][1]; vert[tot][1]= miny+rad-vec[a][0]; @@ -275,7 +266,7 @@ static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int r } } - if(roundboxalign & WIDGET_BOTTOM_RIGHT) { + if(roundboxalign & UI_CNR_BOTTOM_RIGHT) { for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) { vert[tot][0]= maxx-rad+vec[a][0]; vert[tot][1]= miny+vec[a][1]; @@ -288,7 +279,7 @@ static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int r } } - if(roundboxalign & WIDGET_TOP_RIGHT) { + if(roundboxalign & UI_CNR_TOP_RIGHT) { for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) { vert[tot][0]= maxx-vec[a][1]; vert[tot][1]= maxy-rad+vec[a][0]; @@ -315,10 +306,10 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl float facxi= (maxxi!=minxi) ? 1.0f/(maxxi-minxi) : 0.0f; /* for uv, can divide by zero */ float facyi= (maxyi!=minyi) ? 1.0f/(maxyi-minyi) : 0.0f; int a, tot= 0, minsize; - const int hnum= ((roundboxalign & (WIDGET_TOP_LEFT|WIDGET_TOP_RIGHT))==(WIDGET_TOP_LEFT|WIDGET_TOP_RIGHT) || - (roundboxalign & (WIDGET_BOTTOM_RIGHT|WIDGET_BOTTOM_LEFT))==(WIDGET_BOTTOM_RIGHT|WIDGET_BOTTOM_LEFT)) ? 1 : 2; - const int vnum= ((roundboxalign & (WIDGET_TOP_LEFT|WIDGET_BOTTOM_LEFT))==(WIDGET_TOP_LEFT|WIDGET_BOTTOM_LEFT) || - (roundboxalign & (WIDGET_TOP_RIGHT|WIDGET_BOTTOM_RIGHT))==(WIDGET_TOP_RIGHT|WIDGET_BOTTOM_RIGHT)) ? 1 : 2; + const int hnum= ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT))==(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT) || + (roundboxalign & (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT))==(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) ? 1 : 2; + const int vnum= ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT))==(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT) || + (roundboxalign & (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT))==(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) ? 1 : 2; minsize= MIN2((rect->xmax-rect->xmin)*hnum, (rect->ymax-rect->ymin)*vnum); @@ -337,7 +328,7 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl } /* corner left-bottom */ - if(roundboxalign & WIDGET_BOTTOM_LEFT) { + if(roundboxalign & UI_CNR_BOTTOM_LEFT) { for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) { wt->inner_v[tot][0]= minxi+veci[a][1]; @@ -364,7 +355,7 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl } /* corner right-bottom */ - if(roundboxalign & WIDGET_BOTTOM_RIGHT) { + if(roundboxalign & UI_CNR_BOTTOM_RIGHT) { for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) { wt->inner_v[tot][0]= maxxi-radi+veci[a][0]; @@ -393,7 +384,7 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl wt->halfwayvert= tot; /* corner right-top */ - if(roundboxalign & WIDGET_TOP_RIGHT) { + if(roundboxalign & UI_CNR_TOP_RIGHT) { for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) { wt->inner_v[tot][0]= maxxi-veci[a][1]; @@ -420,7 +411,7 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl } /* corner left-top */ - if(roundboxalign & WIDGET_TOP_LEFT) { + if(roundboxalign & UI_CNR_TOP_LEFT) { for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) { wt->inner_v[tot][0]= minxi+radi-veci[a][0]; @@ -1684,7 +1675,7 @@ static void widget_softshadow(rcti *rect, int roundboxalign, float radin, float rect1.ymax -= 2.0f*radout; /* inner part */ - totvert= round_box_shadow_edges(wtb.inner_v, &rect1, radin, roundboxalign & (WIDGET_BOTTOM_RIGHT | WIDGET_BOTTOM_LEFT), 0.0f); + totvert= round_box_shadow_edges(wtb.inner_v, &rect1, radin, roundboxalign & (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT), 0.0f); /* inverse linear shadow alpha */ alpha= 0.15; @@ -1693,7 +1684,7 @@ static void widget_softshadow(rcti *rect, int roundboxalign, float radin, float glEnableClientState(GL_VERTEX_ARRAY); for(step= 1; step<=radout; step++, alpha*=alphastep) { - round_box_shadow_edges(wtb.outer_v, &rect1, radin, WIDGET_ALL_CORNERS, (float)step); + round_box_shadow_edges(wtb.outer_v, &rect1, radin, UI_CNR_ALL, (float)step); glColor4f(0.0f, 0.0f, 0.0f, alpha); @@ -1709,7 +1700,7 @@ static void widget_softshadow(rcti *rect, int roundboxalign, float radin, float static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int direction) { uiWidgetBase wtb; - int roundboxalign= WIDGET_ALL_CORNERS; + int roundboxalign= UI_CNR_ALL; widget_init(&wtb); @@ -1719,11 +1710,11 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir //rect->ymax += 4.0; } else if (direction == UI_DOWN) { - roundboxalign= (WIDGET_BOTTOM_RIGHT | WIDGET_BOTTOM_LEFT); + roundboxalign= (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT); rect->ymin -= 4.0; } else if (direction == UI_TOP) { - roundboxalign= WIDGET_TOP_LEFT | WIDGET_TOP_RIGHT; + roundboxalign= UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT; rect->ymax += 4.0; } @@ -2073,7 +2064,7 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect) widget_init(&wtb); /* fully rounded */ - round_box_edges(&wtb, WIDGET_ALL_CORNERS, rect, rad); + round_box_edges(&wtb, UI_CNR_ALL, rect, rad); /* setup temp colors */ wcol_tmp.outline[0]= wcol_tmp.outline[1]= wcol_tmp.outline[2]= 0; @@ -2211,7 +2202,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat if(horizontal) SWAP(short, wcol->shadetop, wcol->shadedown); - round_box_edges(&wtb, WIDGET_ALL_CORNERS, rect, rad); + round_box_edges(&wtb, UI_CNR_ALL, rect, rad); widgetbase_draw(&wtb, wcol); /* slider */ @@ -2239,7 +2230,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat if (state & UI_SCROLL_NO_OUTLINE) SWAP(short, outline, wtb.outline); - round_box_edges(&wtb, WIDGET_ALL_CORNERS, slider, rad); + round_box_edges(&wtb, UI_CNR_ALL, slider, rad); if(state & UI_SCROLL_ARROWS) { if(wcol->item[0] > 48) wcol->item[0]-= 48; @@ -2406,7 +2397,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s /* left part of slider, always rounded */ rect1.xmax= rect1.xmin + ceil(offs+1.0f); - round_box_edges(&wtb1, roundboxalign & ~(WIDGET_TOP_RIGHT | WIDGET_BOTTOM_RIGHT), &rect1, offs); + round_box_edges(&wtb1, roundboxalign & ~(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT), &rect1, offs); wtb1.outline= 0; widgetbase_draw(&wtb1, wcol); @@ -2417,7 +2408,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s offs*= (rect1.xmax + offs - rect->xmax)/offs; else offs= 0.0f; - round_box_edges(&wtb1, roundboxalign & ~(WIDGET_TOP_LEFT | WIDGET_BOTTOM_LEFT), &rect1, offs); + round_box_edges(&wtb1, roundboxalign & ~(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT), &rect1, offs); widgetbase_draw(&wtb1, wcol); VECCOPY(wcol->outline, outline); @@ -2499,7 +2490,7 @@ static void widget_icon_has_anim(uiBut *UNUSED(but), uiWidgetColors *wcol, rcti wtb.outline= 0; /* rounded */ - round_box_edges(&wtb, WIDGET_ALL_CORNERS, rect, 10.0f); + round_box_edges(&wtb, UI_CNR_ALL, rect, 10.0f); widgetbase_draw(&wtb, wcol); } } @@ -2562,7 +2553,7 @@ static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int widget_init(&wtb); /* half rounded */ - round_box_edges(&wtb, WIDGET_ALL_CORNERS, rect, rad); + round_box_edges(&wtb, UI_CNR_ALL, rect, rad); widgetbase_draw(&wtb, wcol); } @@ -2589,7 +2580,7 @@ static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int UNUSED(sta /* rounded, but no outline */ wtb.outline= 0; - round_box_edges(&wtb, WIDGET_ALL_CORNERS, rect, 4.0f); + round_box_edges(&wtb, UI_CNR_ALL, rect, 4.0f); widgetbase_draw(&wtb, wcol); } @@ -2613,7 +2604,7 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UN recttemp.ymax-= delta; /* half rounded */ - round_box_edges(&wtb, WIDGET_ALL_CORNERS, &recttemp, 4.0f); + round_box_edges(&wtb, UI_CNR_ALL, &recttemp, 4.0f); /* decoration */ if(state & UI_SELECT) { @@ -2713,12 +2704,12 @@ static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType * UI_GetThemeColor3ubv(TH_BACK, col); glColor3ubv(col); - round_box__edges(&wtb, WIDGET_ALL_CORNERS, rect, 0.0f, 4.0); + round_box__edges(&wtb, UI_CNR_ALL, rect, 0.0f, 4.0); widgetbase_outline(&wtb); } /* outline */ - round_box_edges(&wtb, WIDGET_ALL_CORNERS, rect, 5.0f); + round_box_edges(&wtb, UI_CNR_ALL, rect, 5.0f); wtb.outline= 1; wtb.inner= 0; widgetbase_draw(&wtb, &wt->wcol); @@ -2899,27 +2890,27 @@ static int widget_roundbox_set(uiBut *but, rcti *rect) switch(but->flag & UI_BUT_ALIGN) { case UI_BUT_ALIGN_TOP: - return WIDGET_BOTTOM_LEFT | WIDGET_BOTTOM_RIGHT; + return UI_CNR_BOTTOM_LEFT | UI_CNR_BOTTOM_RIGHT; case UI_BUT_ALIGN_DOWN: - return WIDGET_TOP_LEFT | WIDGET_TOP_RIGHT; + return UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT; case UI_BUT_ALIGN_LEFT: - return WIDGET_TOP_RIGHT | WIDGET_BOTTOM_RIGHT; + return UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT; case UI_BUT_ALIGN_RIGHT: - return WIDGET_TOP_LEFT | WIDGET_BOTTOM_LEFT; + return UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT; case UI_BUT_ALIGN_DOWN | UI_BUT_ALIGN_RIGHT: - return WIDGET_TOP_LEFT; + return UI_CNR_TOP_LEFT; case UI_BUT_ALIGN_DOWN | UI_BUT_ALIGN_LEFT: - return WIDGET_TOP_RIGHT; + return UI_CNR_TOP_RIGHT; case UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_RIGHT: - return WIDGET_BOTTOM_LEFT; + return UI_CNR_BOTTOM_LEFT; case UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT: - return WIDGET_BOTTOM_RIGHT; + return UI_CNR_BOTTOM_RIGHT; default: return 0; } } - return WIDGET_ALL_CORNERS; + return UI_CNR_ALL; } /* conversion from old to new buttons, so still messy */ @@ -3157,14 +3148,14 @@ void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect) uiWidgetType *wt= widget_type(UI_WTYPE_BOX); glEnable(GL_BLEND); - widget_softshadow(rect, WIDGET_ALL_CORNERS, 5.0f, 8.0f); + widget_softshadow(rect, UI_CNR_ALL, 5.0f, 8.0f); glDisable(GL_BLEND); wt->state(wt, 0); if(block) - wt->draw(&wt->wcol, rect, block->flag, WIDGET_ALL_CORNERS); + wt->draw(&wt->wcol, rect, block->flag, UI_CNR_ALL); else - wt->draw(&wt->wcol, rect, 0, WIDGET_ALL_CORNERS); + wt->draw(&wt->wcol, rect, 0, UI_CNR_ALL); } diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 692c8940a21..9b9237f70cf 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1039,6 +1039,23 @@ void UI_ColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char c glColor3ub(r, g, b); } +void UI_GetColorPtrShade3ubv(const unsigned char cp[3], unsigned char col[3], int offset) +{ + int r, g, b; + + r= offset+(int)cp[0]; + g= offset+(int)cp[1]; + b= offset+(int)cp[2]; + + CLAMP(r, 0, 255); + CLAMP(g, 0, 255); + CLAMP(b, 0, 255); + + col[0] = r; + col[1] = g; + col[2] = b; +} + // get a 3 byte color, blended and shaded between two other char color pointers void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], float fac, int offset) { diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt index 27308bc9e07..4cf1955ce93 100644 --- a/source/blender/editors/object/CMakeLists.txt +++ b/source/blender/editors/object/CMakeLists.txt @@ -34,7 +34,6 @@ set(INC ../../render/extern/include ../../windowmanager ../../../../intern/guardedalloc - ../../../../extern/recastnavigation/Recast/Include ) set(INC_SYS @@ -61,6 +60,10 @@ set(SRC ) if(WITH_GAMEENGINE) + list(APPEND INC + ../../../../extern/recastnavigation/Recast/Include + ) + list(APPEND SRC object_navmesh.cpp ) diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index bc97cd9d3ff..d41d3245623 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -233,28 +233,28 @@ static void region_draw_azone_tab(AZone *az) /* add code to draw region hidden as 'too small' */ switch(az->edge) { case AE_TOP_TO_BOTTOMRIGHT: - uiSetRoundBox(3 + 16); + uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_RB_ALPHA); uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f); glColor4ub(0, 0, 0, 255); uiRoundRect((float)az->x1, 0.3f+(float)az->y1, (float)az->x2, 0.3f+(float)az->y2, 4.0f); break; case AE_BOTTOM_TO_TOPLEFT: - uiSetRoundBox(12 + 16); + uiSetRoundBox(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT | UI_RB_ALPHA); uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f); glColor4ub(0, 0, 0, 255); uiRoundRect((float)az->x1, 0.3f+(float)az->y1, (float)az->x2, 0.3f+(float)az->y2, 4.0f); break; case AE_LEFT_TO_TOPRIGHT: - uiSetRoundBox(9 + 16); + uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT | UI_RB_ALPHA); uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f); glColor4ub(0, 0, 0, 255); uiRoundRect((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f); break; case AE_RIGHT_TO_TOPLEFT: - uiSetRoundBox(6 + 16); + uiSetRoundBox(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | UI_RB_ALPHA); uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f); glColor4ub(0, 0, 0, 255); diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 9fecfda7764..0080317aece 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -239,7 +239,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar) static void draw_tile(int sx, int sy, int width, int height, int colorid, int shade) { UI_ThemeColorShade(colorid, shade); - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); uiRoundBox((float)sx, (float)(sy - height), (float)(sx + width), (float)sy, 5.0f); } @@ -507,7 +507,7 @@ void file_draw_list(const bContext *C, ARegion *ar) draw_tile(sx, sy-1, layout->tile_w+4, sfile->layout->tile_h+layout->tile_border_y, colorid, shade); } } - uiSetRoundBox(0); + uiSetRoundBox(UI_CNR_NONE); if ( FILE_IMGDISPLAY == params->display ) { is_icon = 0; diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 0c9c7877ddc..6af43e7618d 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -376,7 +376,7 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStr if (nonSolo == 0) { /* strip is in normal track */ glColor3fv(color); - uiSetRoundBox(15); /* all corners rounded */ + uiSetRoundBox(UI_CNR_ALL); /* all corners rounded */ uiDrawBoxShade(GL_POLYGON, strip->start, yminc, strip->end, ymaxc, 0.0, 0.5, 0.1); } @@ -811,7 +811,7 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie offset += 7 * indent; /* only on top two corners, to show that this channel sits on top of the preceding ones */ - uiSetRoundBox((1|2)); + uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); /* draw slightly shifted up vertically to look like it has more separtion from other channels, * but we then need to slightly shorten it so that it doesn't look like it overlaps diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 623855485d7..9ea1e8ee877 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -305,7 +305,7 @@ static void node_buts_curvecol(uiLayout *layout, bContext *UNUSED(C), PointerRNA if(_sample_col) { cumap->flag |= CUMA_DRAW_SAMPLE; - VECCOPY(cumap->sample, _sample_col); + copy_v3_v3(cumap->sample, _sample_col); } else cumap->flag &= ~CUMA_DRAW_SAMPLE; @@ -741,23 +741,23 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN /* backdrop header */ glEnable(GL_BLEND); - uiSetRoundBox(3); + uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); UI_ThemeColorShadeAlpha(TH_NODE_GROUP, 0, -70); uiDrawBox(GL_POLYGON, rect.xmin-node_group_frame, rect.ymax, rect.xmax+node_group_frame, rect.ymax+group_header, BASIS_RAD); /* backdrop body */ UI_ThemeColorShadeAlpha(TH_BACK, -8, -70); - uiSetRoundBox(0); + uiSetRoundBox(UI_CNR_NONE); uiDrawBox(GL_POLYGON, rect.xmin, rect.ymin, rect.xmax, rect.ymax, BASIS_RAD); /* input column */ UI_ThemeColorShadeAlpha(TH_BACK, 10, -50); - uiSetRoundBox(8); + uiSetRoundBox(UI_CNR_BOTTOM_LEFT); uiDrawBox(GL_POLYGON, rect.xmin-node_group_frame, rect.ymin, rect.xmin, rect.ymax, BASIS_RAD); /* output column */ UI_ThemeColorShadeAlpha(TH_BACK, 10, -50); - uiSetRoundBox(4); + uiSetRoundBox(UI_CNR_BOTTOM_RIGHT); uiDrawBox(GL_POLYGON, rect.xmax, rect.ymin, rect.xmax+node_group_frame, rect.ymax, BASIS_RAD); /* input column separator */ @@ -775,7 +775,7 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN glEnd(); /* group node outline */ - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); glColor4ub(200, 200, 200, 140); glEnable( GL_LINE_SMOOTH ); uiDrawBox(GL_LINE_LOOP, rect.xmin-node_group_frame, rect.ymin, rect.xmax+node_group_frame, rect.ymax+group_header, BASIS_RAD); diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index ba1e8d3dd59..c1b114d5436 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -568,7 +568,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN return; } - uiSetRoundBox(15-4); + uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_LEFT); ui_dropshadow(rct, BASIS_RAD, snode->aspect, node->flag & SELECT); /* header */ @@ -580,7 +580,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN if(node->flag & NODE_MUTED) UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f); - uiSetRoundBox(3); + uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); uiRoundBox(rct->xmin, rct->ymax-NODE_DY, rct->xmax, rct->ymax, BASIS_RAD); /* show/hide icons, note this sequence is copied in do_header_node() node_state.c */ @@ -648,7 +648,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN /* body */ UI_ThemeColor4(TH_NODE); glEnable(GL_BLEND); - uiSetRoundBox(8); + uiSetRoundBox(UI_CNR_BOTTOM_LEFT); uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax-NODE_DY, BASIS_RAD); glDisable(GL_BLEND); @@ -664,7 +664,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, -40); else UI_ThemeColorShadeAlpha(TH_TEXT_HI, -20, -120); - uiSetRoundBox(15-4); // round all corners except lower right + uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_LEFT); // round all corners except lower right uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD); glDisable( GL_LINE_SMOOTH ); @@ -745,7 +745,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b char showname[128]; /* 128 is used below */ /* shadow */ - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); ui_dropshadow(rct, hiddenrad, snode->aspect, node->flag & SELECT); /* body */ diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index e77bb979d47..357730aff39 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1182,7 +1182,7 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa if(active) { float ufac= UI_UNIT_X/20.0f; - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); glColor4ub(255, 255, 255, 100); uiRoundBox( (float)*offsx-0.5f*ufac, (float)ys-1.0f*ufac, (float)*offsx+UI_UNIT_Y-3.0f*ufac, (float)ys+UI_UNIT_Y-3.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac); glEnable(GL_BLEND); /* roundbox disables */ @@ -1313,7 +1313,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene /* active circle */ if(active) { - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); uiRoundBox( (float)startx+UI_UNIT_Y-1.5f*ufac, (float)*starty+2.0f*ufac, (float)startx+2.0f*UI_UNIT_Y-4.0f*ufac, (float)*starty+UI_UNIT_Y-1.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac); glEnable(GL_BLEND); /* roundbox disables it */ diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 299fe9df460..0f5398f24a7 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -99,7 +99,7 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[ UI_GetThemeColor3ubv(TH_SEQ_SCENE, col); if(seq->scene==curscene) { - UI_GetColorPtrBlendShade3ubv(col, col, col, 1.0, 20); + UI_GetColorPtrShade3ubv(col, col, 20); } break; @@ -299,7 +299,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, glRectf(x1_chan, y1_chan, x2_chan, y2_chan); - UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -30); + UI_GetColorPtrShade3ubv(col, col, -30); glColor4ubv(col); fdrawbox(x1_chan, y1_chan, x2_chan, y2_chan); @@ -473,7 +473,7 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq) /* feint pinstripes, helps see exactly which is extended and which isn't, * especially when the extension is very small */ if (seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 24); - else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -16); + else UI_GetColorPtrShade3ubv(col, col, -16); glColor3ubv((GLubyte *)col); @@ -490,8 +490,8 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq) /* feint pinstripes, helps see exactly which is extended and which isn't, * especially when the extension is very small */ - if (seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 24); - else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -16); + if (seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, 24); + else UI_GetColorPtrShade3ubv(col, col, -16); glColor3ubv((GLubyte *)col); @@ -584,8 +584,8 @@ static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, floa glBegin(GL_QUADS); if(seq->flag & SEQ_INVALID_EFFECT) { col[0]= 255; col[1]= 0; col[2]= 255; } - else if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -50); - else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 0); + else if(seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, -50); + /* else UI_GetColorPtrShade3ubv(col, col, 0); */ /* DO NOTHING */ glColor3ubv(col); @@ -594,7 +594,7 @@ static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, floa if(seq->flag & SEQ_INVALID_EFFECT) { col[0]= 255; col[1]= 0; col[2]= 255; } else if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 5); - else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -5); + else UI_GetColorPtrShade3ubv(col, col, -5); glColor3ubv((GLubyte *)col); @@ -610,8 +610,8 @@ static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, floa glVertex2f(x1,ymid2); glVertex2f(x2,ymid2); - if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -15); - else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 25); + if(seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, -15); + else UI_GetColorPtrShade3ubv(col, col, 25); glColor3ubv((GLubyte *)col); @@ -697,10 +697,10 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline col[0]= 255; col[1]= col[2]= 40; } else - UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 120+outline_tint); + UI_GetColorPtrShade3ubv(col, col, 120+outline_tint); } else - UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, outline_tint); + UI_GetColorPtrShade3ubv(col, col, outline_tint); glColor3ubv((GLubyte *)col); @@ -914,7 +914,7 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); uiDrawBox(GL_LINE_LOOP, x1, y1, x2, y2, 12.0); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 066404f23ba..3d49bc7ffa0 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1190,7 +1190,7 @@ static void draw_textscroll(SpaceText *st, rcti *scroll, rcti *back) uiWidgetScrollDraw(&wcol, scroll, &st->txtbar, (st->flags & ST_SCROLL_SELECT)?UI_SCROLL_PRESSED:0); - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); rad= 0.4f*MIN2(st->txtscroll.xmax - st->txtscroll.xmin, st->txtscroll.ymax - st->txtscroll.ymin); UI_GetThemeColor3ubv(TH_HILITE, col); col[3]= 48; diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 4aec1a8e61c..fc35ab93f70 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -827,7 +827,7 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, if (0.0f != normalize_v3(dirvec)) { float norvech[3], norvect[3], vec[3]; - VECCOPY(vec, dirvec); + copy_v3_v3(vec, dirvec); mul_v3_fl(dirvec, head); cross_v3_v3v3(norvech, dirvec, imat[2]); @@ -1544,7 +1544,7 @@ static void draw_pose_dofs(Object *ob) /* in parent-bone pose, but own restspace */ glPushMatrix(); - VECCOPY(posetrans, pchan->pose_mat[3]); + copy_v3_v3(posetrans, pchan->pose_mat[3]); glTranslatef(posetrans[0], posetrans[1], posetrans[2]); if (pchan->parent) { @@ -1642,7 +1642,7 @@ static void bone_matrix_translate_y(float mat[][4], float y) { float trans[3]; - VECCOPY(trans, mat[1]); + copy_v3_v3(trans, mat[1]); mul_v3_fl(trans, y); add_v3_v3(mat[3], trans); } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 5d10764dad3..a20e3093955 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -142,7 +142,7 @@ static int check_ob_drawface_dot(Scene *sce, View3D *vd, char dt) /* ************* only use while object drawing ************** * or after running ED_view3d_init_mats_rv3d * */ -static void view3d_project_short_clip(ARegion *ar, float *vec, short *adr, int local) +static void view3d_project_short_clip(ARegion *ar, const float vec[3], short *adr, int local) { RegionView3D *rv3d= ar->regiondata; float fx, fy, vec4[4]; @@ -177,7 +177,7 @@ static void view3d_project_short_clip(ARegion *ar, float *vec, short *adr, int l } /* only use while object drawing */ -static void view3d_project_short_noclip(ARegion *ar, float *vec, short *adr) +static void view3d_project_short_noclip(ARegion *ar, const float vec[3], short *adr) { RegionView3D *rv3d= ar->regiondata; float fx, fy, vec4[4]; @@ -840,7 +840,7 @@ static void drawcube_size(float size) /* this is an unused (old) cube-drawing function based on a given size */ #if 0 -static void drawcube_size(float *size) +static void drawcube_size(const float size[3]) { glPushMatrix(); @@ -894,7 +894,7 @@ static void drawshadbuflimits(Lamp *la, float mat[][4]) -static void spotvolume(float *lvec, float *vvec, float inp) +static void spotvolume(float lvec[3], float vvec[3], const float inp) { /* camera is at 0,0,0 */ float temp[3],plane[3],mat1[3][3],mat2[3][3],mat3[3][3],mat4[3][3],q[4],co,si,angle; @@ -923,8 +923,8 @@ static void spotvolume(float *lvec, float *vvec, float inp) normalize_v3(&q[1]); angle = saacos(plane[2])/2.0f; - co = cos(angle); - si = sqrt(1-co*co); + co = cosf(angle); + si = sqrtf(1-co*co); q[0] = co; q[1] *= si; @@ -938,7 +938,7 @@ static void spotvolume(float *lvec, float *vvec, float inp) unit_m3(mat2); co = inp; - si = sqrt(1-inp*inp); + si = sqrtf(1.0f-inp*inp); mat2[0][0] = co; mat2[1][0] = -si; @@ -5123,7 +5123,7 @@ static void draw_textcurs(float textcurs[][2]) set_inverted_drawing(0); } -static void drawspiral(float *cent, float rad, float tmat[][4], int start) +static void drawspiral(const float cent[3], float rad, float tmat[][4], int start) { float vec[3], vx[3], vy[3]; int a, tot=32; @@ -5194,7 +5194,7 @@ static void drawcircle_size(float size) } /* needs fixing if non-identity matrice used */ -static void drawtube(float *vec, float radius, float height, float tmat[][4]) +static void drawtube(const float vec[3], float radius, float height, float tmat[][4]) { float cur[3]; drawcircball(GL_LINE_LOOP, vec, radius, tmat); @@ -5216,7 +5216,7 @@ static void drawtube(float *vec, float radius, float height, float tmat[][4]) glEnd(); } /* needs fixing if non-identity matrice used */ -static void drawcone(float *vec, float radius, float height, float tmat[][4]) +static void drawcone(const float vec[3], float radius, float height, float tmat[][4]) { float cur[3]; @@ -5492,7 +5492,7 @@ static void draw_box(float vec[8][3]) /* uses boundbox, function used by Ketsji */ #if 0 -static void get_local_bounds(Object *ob, float *center, float *size) +static void get_local_bounds(Object *ob, float center[3], float size[3]) { BoundBox *bb= object_get_boundbox(ob); diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index 805887e3805..1509cafa05f 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -155,10 +155,10 @@ static int convex(float *p0, float *up, float *a, float *b) { // Vec3 va = a-p0, vb = b-p0; float va[3], vb[3], tmp[3]; - VECSUB(va, a, p0); - VECSUB(vb, b, p0); + sub_v3_v3v3(va, a, p0); + sub_v3_v3v3(vb, b, p0); cross_v3_v3v3(tmp, va, vb); - return INPR(up, tmp) >= 0; + return dot_v3v3(up, tmp) >= 0; } // copied from gpu_extension.c @@ -281,20 +281,20 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3 cv[7][1] = min[1]; cv[7][2] = min[2]; - VECCOPY(edges[0][0], cv[4]); // maxx, maxy, minz - VECCOPY(edges[1][0], cv[5]); // minx, maxy, minz - VECCOPY(edges[2][0], cv[6]); // minx, miny, minz - VECCOPY(edges[3][0], cv[7]); // maxx, miny, minz + copy_v3_v3(edges[0][0], cv[4]); // maxx, maxy, minz + copy_v3_v3(edges[1][0], cv[5]); // minx, maxy, minz + copy_v3_v3(edges[2][0], cv[6]); // minx, miny, minz + copy_v3_v3(edges[3][0], cv[7]); // maxx, miny, minz - VECCOPY(edges[4][0], cv[3]); // maxx, miny, maxz - VECCOPY(edges[5][0], cv[2]); // minx, miny, maxz - VECCOPY(edges[6][0], cv[6]); // minx, miny, minz - VECCOPY(edges[7][0], cv[7]); // maxx, miny, minz + copy_v3_v3(edges[4][0], cv[3]); // maxx, miny, maxz + copy_v3_v3(edges[5][0], cv[2]); // minx, miny, maxz + copy_v3_v3(edges[6][0], cv[6]); // minx, miny, minz + copy_v3_v3(edges[7][0], cv[7]); // maxx, miny, minz - VECCOPY(edges[8][0], cv[1]); // minx, maxy, maxz - VECCOPY(edges[9][0], cv[2]); // minx, miny, maxz - VECCOPY(edges[10][0], cv[6]); // minx, miny, minz - VECCOPY(edges[11][0], cv[5]); // minx, maxy, minz + copy_v3_v3(edges[8][0], cv[1]); // minx, maxy, maxz + copy_v3_v3(edges[9][0], cv[2]); // minx, miny, maxz + copy_v3_v3(edges[10][0], cv[6]); // minx, miny, minz + copy_v3_v3(edges[11][0], cv[5]); // minx, maxy, minz // printf("size x: %f, y: %f, z: %f\n", size[0], size[1], size[2]); // printf("min[2]: %f, max[2]: %f\n", min[2], max[2]); @@ -333,7 +333,7 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3 */ // get view vector - VECCOPY(viewnormal, rv3d->viewinv[2]); + copy_v3_v3(viewnormal, rv3d->viewinv[2]); normalize_v3(viewnormal); // find cube vertex that is closest to the viewer @@ -408,10 +408,10 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3 if(dd*(float)n > ds) break; - VECCOPY(tmp_point, viewnormal); + copy_v3_v3(tmp_point, viewnormal); mul_v3_fl(tmp_point, -dd*((ds/dd)-(float)n)); - VECADD(tmp_point2, cv[good_index], tmp_point); - d = INPR(tmp_point2, viewnormal); + add_v3_v3v3(tmp_point2, cv[good_index], tmp_point); + d = dot_v3v3(tmp_point2, viewnormal); // printf("my d: %f\n", d); @@ -422,7 +422,7 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3 // printf("points: %d\n", numpoints); if (numpoints > 2) { - VECCOPY(p0, points); + copy_v3_v3(p0, points); // sort points to get a convex polygon for(i = 1; i < numpoints - 1; i++) @@ -432,9 +432,9 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3 if(!convex(p0, viewnormal, &points[j * 3], &points[i * 3])) { float tmp2[3]; - VECCOPY(tmp2, &points[j * 3]); - VECCOPY(&points[j * 3], &points[i * 3]); - VECCOPY(&points[i * 3], tmp2); + copy_v3_v3(tmp2, &points[j * 3]); + copy_v3_v3(&points[j * 3], &points[i * 3]); + copy_v3_v3(&points[i * 3], tmp2); } } } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 98768e369cb..ba9faf7682e 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -150,20 +150,22 @@ void circ(float x, float y, float rad) static void view3d_draw_clipping(RegionView3D *rv3d) { BoundBox *bb= rv3d->clipbb; - + if(bb) { + static unsigned int clipping_index[6][4]= {{0, 1, 2, 3}, + {0, 4, 5, 1}, + {4, 7, 6, 5}, + {7, 3, 2, 6}, + {1, 5, 6, 2}, + {7, 4, 0, 3}}; + UI_ThemeColorShade(TH_BACK, -8); - - glBegin(GL_QUADS); - - glVertex3fv(bb->vec[0]); glVertex3fv(bb->vec[1]); glVertex3fv(bb->vec[2]); glVertex3fv(bb->vec[3]); - glVertex3fv(bb->vec[0]); glVertex3fv(bb->vec[4]); glVertex3fv(bb->vec[5]); glVertex3fv(bb->vec[1]); - glVertex3fv(bb->vec[4]); glVertex3fv(bb->vec[7]); glVertex3fv(bb->vec[6]); glVertex3fv(bb->vec[5]); - glVertex3fv(bb->vec[7]); glVertex3fv(bb->vec[3]); glVertex3fv(bb->vec[2]); glVertex3fv(bb->vec[6]); - glVertex3fv(bb->vec[1]); glVertex3fv(bb->vec[5]); glVertex3fv(bb->vec[6]); glVertex3fv(bb->vec[2]); - glVertex3fv(bb->vec[7]); glVertex3fv(bb->vec[4]); glVertex3fv(bb->vec[0]); glVertex3fv(bb->vec[3]); - - glEnd(); + + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, 0, bb->vec); + glDrawElements(GL_QUADS, sizeof(clipping_index)/sizeof(unsigned int), GL_UNSIGNED_INT, clipping_index); + glDisableClientState(GL_VERTEX_ARRAY); + } } @@ -194,11 +196,11 @@ static int test_clipping(const float vec[3], float clip[][4]) { float view[3]; copy_v3_v3(view, vec); - - if(0.0f < clip[0][3] + INPR(view, clip[0])) - if(0.0f < clip[1][3] + INPR(view, clip[1])) - if(0.0f < clip[2][3] + INPR(view, clip[2])) - if(0.0f < clip[3][3] + INPR(view, clip[3])) + + if(0.0f < clip[0][3] + dot_v3v3(view, clip[0])) + if(0.0f < clip[1][3] + dot_v3v3(view, clip[1])) + if(0.0f < clip[2][3] + dot_v3v3(view, clip[2])) + if(0.0f < clip[3][3] + dot_v3v3(view, clip[3])) return 0; return 1; @@ -216,36 +218,37 @@ int ED_view3d_test_clipping(RegionView3D *rv3d, const float vec[3], const int lo static void drawgrid_draw(ARegion *ar, float wx, float wy, float x, float y, float dx) { - float v1[2], v2[2]; + float verts[2][2]; x+= (wx); y+= (wy); - v1[1]= 0.0f; - v2[1]= (float)ar->winy; + /* set fixed 'Y' */ + verts[0][1]= 0.0f; + verts[1][1]= (float)ar->winy; - v1[0] = v2[0] = x-dx*floorf(x/dx); - - glBegin(GL_LINES); - - while(v1[0] < ar->winx) { - glVertex2fv(v1); - glVertex2fv(v2); - v1[0] = v2[0] = v1[0] + dx; - } + /* iter over 'X' */ + verts[0][0] = verts[1][0] = x-dx*floorf(x/dx); + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(2, GL_FLOAT, 0, verts); - v1[0]= 0.0f; - v2[0]= (float)ar->winx; + while(verts[0][0] < ar->winx) { + glDrawArrays(GL_LINES, 0, 2); + verts[0][0] = verts[1][0] = verts[0][0] + dx; + } - v1[1]= v2[1]= y-dx*floorf(y/dx); + /* set fixed 'X' */ + verts[0][0]= 0.0f; + verts[1][0]= (float)ar->winx; - while(v1[1] < ar->winy) { - glVertex2fv(v1); - glVertex2fv(v2); - v1[1] = v2[1] = v1[1] + dx; + /* iter over 'Y' */ + verts[0][1]= verts[1][1]= y-dx*floorf(y/dx); + while(verts[0][1] < ar->winy) { + glDrawArrays(GL_LINES, 0, 2); + verts[0][1] = verts[1][1] = verts[0][1] + dx; } - glEnd(); + glDisableClientState(GL_VERTEX_ARRAY); } #define GRID_MIN_PX 6.0f @@ -425,13 +428,10 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit) { - float vert[3], grid, grid_scale; - int a, gridlines, emphasise; - unsigned char col[3], col2[3]; - short draw_line = 0; - - vert[2]= 0.0; - + float grid, grid_scale; + unsigned char col_grid[3]; + const int gridlines= v3d->gridlines/2; + if(v3d->gridlines<3) return; grid_scale= v3d->grid; @@ -450,115 +450,81 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit) grid_scale = (grid_scale * (float)bUnit_GetScaler(usys, i)) / scene->unit.scale_length; } } - - if(v3d->zbuf && scene->obedit) glDepthMask(0); // for zbuffer-select - - gridlines= v3d->gridlines/2; + grid= gridlines * grid_scale; - UI_GetThemeColor3ubv(TH_GRID, col); - UI_GetThemeColor3ubv(TH_BACK, col2); - - /* emphasise division lines lighter instead of darker, if background is darker than grid */ - if ( ((col[0]+col[1]+col[2])/3+10) > (col2[0]+col2[1]+col2[2])/3 ) - emphasise = 20; - else - emphasise = -10; - + if(v3d->zbuf && scene->obedit) glDepthMask(0); // for zbuffer-select + + UI_GetThemeColor3ubv(TH_GRID, col_grid); + /* draw the Y axis and/or grid lines */ - for(a= -gridlines;a<=gridlines;a++) { - if(a==0) { - /* check for the 'show Y axis' preference */ - if (v3d->gridflag & V3D_SHOW_Y) { - UI_make_axis_color(col, col2, 'Y'); - glColor3ubv(col2); - - draw_line = 1; - } else if (v3d->gridflag & V3D_SHOW_FLOOR) { - UI_ThemeColorShade(TH_GRID, emphasise); - } else { - draw_line = 0; + if(v3d->gridflag & V3D_SHOW_FLOOR) { + float vert[4][3]= {{0.0f}}; + unsigned char col_bg[3]; + unsigned char col_grid_emphasise[3], col_grid_light[3]; + int a; + int prev_emphasise= -1; + + UI_GetThemeColor3ubv(TH_BACK, col_bg); + + /* emphasise division lines lighter instead of darker, if background is darker than grid */ + UI_GetColorPtrShade3ubv(col_grid, col_grid_light, 10); + UI_GetColorPtrShade3ubv(col_grid, col_grid_emphasise, + (((col_grid[0]+col_grid[1]+col_grid[2])+30) > (col_bg[0]+col_bg[1]+col_bg[2])) ? 20 : -10); + + /* set fixed axis */ + vert[0][0]= vert[2][1]= grid; + vert[1][0]= vert[3][1]= -grid; + + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, 0, vert); + + for(a= -gridlines;a<=gridlines;a++) { + const float line= a * grid_scale; + const int is_emphasise= (a % 10) == 0; + + if(is_emphasise != prev_emphasise) { + glColor3ubv(is_emphasise ? col_grid_emphasise : col_grid_light); + prev_emphasise= is_emphasise; } - } else { - /* check for the 'show grid floor' preference */ - if (v3d->gridflag & V3D_SHOW_FLOOR) { - if( (a % 10)==0) { - UI_ThemeColorShade(TH_GRID, emphasise); - } - else UI_ThemeColorShade(TH_GRID, 10); - - draw_line = 1; - } else { - draw_line = 0; - } - } - - if (draw_line) { - glBegin(GL_LINE_STRIP); - vert[0]= a * grid_scale; - vert[1]= grid; - glVertex3fv(vert); - vert[1]= -grid; - glVertex3fv(vert); - glEnd(); + + /* set variable axis */ + vert[0][1]= vert[1][1]= + vert[2][0]= vert[3][0]= line; + + glDrawArrays(GL_LINES, 0, 4); } + + glDisableClientState(GL_VERTEX_ARRAY); + + GPU_print_error("sdsd"); } - /* draw the X axis and/or grid lines */ - for(a= -gridlines;a<=gridlines;a++) { - if(a==0) { - /* check for the 'show X axis' preference */ - if (v3d->gridflag & V3D_SHOW_X) { - UI_make_axis_color(col, col2, 'X'); - glColor3ubv(col2); - - draw_line = 1; - } else if (v3d->gridflag & V3D_SHOW_FLOOR) { - UI_ThemeColorShade(TH_GRID, emphasise); - } else { - draw_line = 0; - } - } else { - /* check for the 'show grid floor' preference */ - if (v3d->gridflag & V3D_SHOW_FLOOR) { - if( (a % 10)==0) { - UI_ThemeColorShade(TH_GRID, emphasise); - } - else UI_ThemeColorShade(TH_GRID, 10); - - draw_line = 1; - } else { - draw_line = 0; - } - } - - if (draw_line) { + /* draw the Z axis line */ + /* check for the 'show Z axis' preference */ + if (v3d->gridflag & (V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_Z)) { + int axis; + for(axis= 0; axis < 3; axis++) + if (v3d->gridflag & (V3D_SHOW_X << axis)) { + float vert[3]; + unsigned char tcol[3]; + + UI_make_axis_color(col_grid, tcol, 'X' + axis); + glColor3ubv(tcol); + glBegin(GL_LINE_STRIP); - vert[1]= a * grid_scale; - vert[0]= grid; + zero_v3(vert); + vert[axis]= grid; glVertex3fv(vert ); - vert[0]= -grid; + vert[axis]= -grid; glVertex3fv(vert); glEnd(); } } - - /* draw the Z axis line */ - /* check for the 'show Z axis' preference */ - if (v3d->gridflag & V3D_SHOW_Z) { - UI_make_axis_color(col, col2, 'Z'); - glColor3ubv(col2); - - glBegin(GL_LINE_STRIP); - vert[0]= 0; - vert[1]= 0; - vert[2]= grid; - glVertex3fv(vert ); - vert[2]= -grid; - glVertex3fv(vert); - glEnd(); - } - + + + + if(v3d->zbuf && scene->obedit) glDepthMask(1); } @@ -697,60 +663,63 @@ static void draw_rotation_guide(RegionView3D *rv3d) float scaled_axis[3]; const float scale = rv3d->dist; mul_v3_v3fl(scaled_axis, rv3d->rot_axis, scale); - + + glBegin(GL_LINE_STRIP); - color[3] = 0.f; // more transparent toward the ends - glColor4fv(color); - add_v3_v3v3(end, o, scaled_axis); - glVertex3fv(end); - - // color[3] = 0.2f + fabsf(rv3d->rot_angle); // modulate opacity with angle - // ^^ neat idea, but angle is frame-rate dependent, so it's usually close to 0.2 + color[3] = 0.f; // more transparent toward the ends + glColor4fv(color); + add_v3_v3v3(end, o, scaled_axis); + glVertex3fv(end); - color[3] = 0.5f; // more opaque toward the center - glColor4fv(color); - glVertex3fv(o); - - color[3] = 0.f; - glColor4fv(color); - sub_v3_v3v3(end, o, scaled_axis); - glVertex3fv(end); + // color[3] = 0.2f + fabsf(rv3d->rot_angle); // modulate opacity with angle + // ^^ neat idea, but angle is frame-rate dependent, so it's usually close to 0.2 + + color[3] = 0.5f; // more opaque toward the center + glColor4fv(color); + glVertex3fv(o); + + color[3] = 0.f; + glColor4fv(color); + sub_v3_v3v3(end, o, scaled_axis); + glVertex3fv(end); glEnd(); // -- draw ring around rotation center -- { - #define ROT_AXIS_DETAIL 13 - const float s = 0.05f * scale; - const float step = 2.f * (float)(M_PI / ROT_AXIS_DETAIL); - float angle; - int i; - - float q[4]; // rotate ring so it's perpendicular to axis - const int upright = fabsf(rv3d->rot_axis[2]) >= 0.95f; - if (!upright) - { - const float up[3] = {0.f, 0.f, 1.f}; - float vis_angle, vis_axis[3]; - - cross_v3_v3v3(vis_axis, up, rv3d->rot_axis); - vis_angle = acosf(dot_v3v3(up, rv3d->rot_axis)); - axis_angle_to_quat(q, vis_axis, vis_angle); +#define ROT_AXIS_DETAIL 13 + + const float s = 0.05f * scale; + const float step = 2.f * (float)(M_PI / ROT_AXIS_DETAIL); + float angle; + int i; + + float q[4]; // rotate ring so it's perpendicular to axis + const int upright = fabsf(rv3d->rot_axis[2]) >= 0.95f; + if (!upright) { + const float up[3] = {0.f, 0.f, 1.f}; + float vis_angle, vis_axis[3]; + + cross_v3_v3v3(vis_axis, up, rv3d->rot_axis); + vis_angle = acosf(dot_v3v3(up, rv3d->rot_axis)); + axis_angle_to_quat(q, vis_axis, vis_angle); } - color[3] = 0.25f; // somewhat faint - glColor4fv(color); - glBegin(GL_LINE_LOOP); - for (i = 0, angle = 0.f; i < ROT_AXIS_DETAIL; ++i, angle += step) - { - float p[3] = { s * cosf(angle), s * sinf(angle), 0.f }; + color[3] = 0.25f; // somewhat faint + glColor4fv(color); + glBegin(GL_LINE_LOOP); + for (i = 0, angle = 0.f; i < ROT_AXIS_DETAIL; ++i, angle += step) { + float p[3] = {s * cosf(angle), s * sinf(angle), 0.0f}; - if (!upright) - mul_qt_v3(q, p); + if (!upright) { + mul_qt_v3(q, p); + } - add_v3_v3(p, o); - glVertex3fv(p); + add_v3_v3(p, o); + glVertex3fv(p); } - glEnd(); + glEnd(); + +#undef ROT_AXIS_DETAIL } color[3] = 1.f; // solid dot @@ -1237,7 +1206,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); - uiSetRoundBox(15); + uiSetRoundBox(UI_CNR_ALL); uiDrawBox(GL_LINE_LOOP, x1, y1, x2, y2, 12.0); } } diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt index c1e618fd4cb..97f5d508d26 100644 --- a/source/blender/editors/util/CMakeLists.txt +++ b/source/blender/editors/util/CMakeLists.txt @@ -24,7 +24,6 @@ set(INC ../../blenkernel ../../blenlib ../../blenloader - ../../../../extern/recastnavigation/Recast/Include ../../bmesh ../../makesdna ../../makesrna @@ -64,7 +63,6 @@ set(SRC ../include/ED_markers.h ../include/ED_mball.h ../include/ED_mesh.h - ../include/ED_navmesh_conversion.h ../include/ED_node.h ../include/ED_numinput.h ../include/ED_object.h @@ -92,8 +90,14 @@ set(SRC ) if(WITH_GAMEENGINE) + list(APPEND INC + ../../../../extern/recastnavigation/Recast/Include + ) + list(APPEND SRC navmesh_conversion.cpp + + ../include/ED_navmesh_conversion.h ) endif() diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 8c58e4f3a33..9a35e9762df 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -35,11 +35,8 @@ set(INC ../makesrna ../bmesh ../render/extern/include - ../editors/include - ../gpu ../../../intern/elbeem/extern ../../../intern/guardedalloc - ../../../extern/recastnavigation/Recast/Include ) set(INC_SYS @@ -122,7 +119,13 @@ if(NOT WITH_MOD_FLUID) endif() if(WITH_GAMEENGINE) + # for MOD_navmesh.cpp add_definitions(-DWITH_GAMEENGINE) + list(APPEND INC + ../gpu + ../../../extern/recastnavigation/Recast/Include + ../editors/include # XXX - BAD LEVEL CALL, REMOVE BEFORE RELEASE + ) endif() blender_add_lib(bf_modifiers "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/modifiers/intern/MOD_navmesh.cpp b/source/blender/modifiers/intern/MOD_navmesh.cpp index bc97023a58b..d32281c12b6 100644 --- a/source/blender/modifiers/intern/MOD_navmesh.cpp +++ b/source/blender/modifiers/intern/MOD_navmesh.cpp @@ -26,10 +26,20 @@ * */ #include <math.h> -#include "Recast.h" + +#ifdef WITH_GAMEENGINE +# include "Recast.h" +#endif extern "C"{ -#include "ED_navmesh_conversion.h" + +#ifdef WITH_GAMEENGINE +# include "ED_navmesh_conversion.h" +# include "BIF_gl.h" +# include "GPU_buffers.h" +# include "GPU_draw.h" +# include "UI_resources.h" +#endif #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" @@ -43,10 +53,6 @@ extern "C"{ #include "BKE_particle.h" #include "BKE_customdata.h" #include "MEM_guardedalloc.h" -#include "BIF_gl.h" -#include "GPU_buffers.h" -#include "GPU_draw.h" -#include "UI_resources.h" static void initData(ModifierData *md) { diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 717f2b7001b..a2cca9ea77b 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -63,16 +63,6 @@ #define OUT_OF_MEMORY() ((void)printf("WeightVGProximity: Out of memory.\n")) /** - * Returns the squared distance between two given points. - */ -static float squared_dist(const float *a, const float *b) -{ - float tmp[3]; - VECSUB(tmp, a, b); - return INPR(tmp, tmp); -} - -/** * Find nearest vertex and/or edge and/or face, for each vertex (adapted from shrinkwrap.c). */ static void get_vert2geom_distance(int numVerts, float (*v_cos)[3], @@ -137,19 +127,19 @@ static void get_vert2geom_distance(int numVerts, float (*v_cos)[3], * This will lead in prunning of the search tree. */ if (dist_v) { - nearest_v.dist = nearest_v.index != -1 ? squared_dist(tmp_co, nearest_v.co) : FLT_MAX; + nearest_v.dist = nearest_v.index != -1 ? len_squared_v3v3(tmp_co, nearest_v.co) : FLT_MAX; /* Compute and store result. If invalid (-1 idx), keep FLT_MAX dist. */ BLI_bvhtree_find_nearest(treeData_v.tree, tmp_co, &nearest_v, treeData_v.nearest_callback, &treeData_v); dist_v[i] = sqrtf(nearest_v.dist); } if (dist_e) { - nearest_e.dist = nearest_e.index != -1 ? squared_dist(tmp_co, nearest_e.co) : FLT_MAX; + nearest_e.dist = nearest_e.index != -1 ? len_squared_v3v3(tmp_co, nearest_e.co) : FLT_MAX; /* Compute and store result. If invalid (-1 idx), keep FLT_MAX dist. */ BLI_bvhtree_find_nearest(treeData_e.tree, tmp_co, &nearest_e, treeData_e.nearest_callback, &treeData_e); dist_e[i] = sqrtf(nearest_e.dist); } if (dist_f) { - nearest_f.dist = nearest_f.index != -1 ? squared_dist(tmp_co, nearest_f.co) : FLT_MAX; + nearest_f.dist = nearest_f.index != -1 ? len_squared_v3v3(tmp_co, nearest_f.co) : FLT_MAX; /* Compute and store result. If invalid (-1 idx), keep FLT_MAX dist. */ BLI_bvhtree_find_nearest(treeData_f.tree, tmp_co, &nearest_f, treeData_f.nearest_callback, &treeData_f); dist_f[i] = sqrtf(nearest_f.dist); diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 13ca40bfd20..0b339d285ce 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -338,7 +338,7 @@ typedef struct ObjectInstanceRen { struct VolumePrecache *volume_precache; - float *vectors; + float *vectors; /* (RE_WINSPEED_ELEMS * VertRen.index) */ int totvector; /* used on makeraytree */ @@ -354,8 +354,8 @@ typedef struct VertRen float co[3]; float n[3]; float *orco; - short clip; - unsigned short flag; /* in use for clipping zbuffer parts, temp setting stuff in convertblender.c */ + unsigned int flag; /* in use for clipping zbuffer parts, temp setting stuff in convertblender.c + * only an 'int' because of alignment, could be a char too */ float accum; /* accum for radio weighting, and for strand texco static particles */ int index; /* index allows extending vertren with any property */ } VertRen; diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h index 67c3cbcebe2..f9486b5d5c0 100644 --- a/source/blender/render/intern/include/rendercore.h +++ b/source/blender/render/intern/include/rendercore.h @@ -81,8 +81,8 @@ float mistfactor(float zcor, float *co); /* dist and height, return alpha */ void renderspothalo(struct ShadeInput *shi, float *col, float alpha); void add_halo_flare(Render *re); -void calc_renderco_zbuf(float *co, float *view, int z); -void calc_renderco_ortho(float *co, float x, float y, int z); +void calc_renderco_zbuf(float co[3], float *view, int z); +void calc_renderco_ortho(float co[3], float x, float y, int z); int count_mask(unsigned short mask); diff --git a/source/blender/render/intern/include/renderdatabase.h b/source/blender/render/intern/include/renderdatabase.h index e1fa208d0b6..06185d0ae74 100644 --- a/source/blender/render/intern/include/renderdatabase.h +++ b/source/blender/render/intern/include/renderdatabase.h @@ -91,7 +91,7 @@ void free_renderdata_vertnodes(struct VertTableNode *vertnodes); void free_renderdata_vlaknodes(struct VlakTableNode *vlaknodes); void set_normalflags(struct Render *re, struct ObjectRen *obr); -void project_renderdata(struct Render *re, void (*projectfunc)(float *, float mat[][4], float *), int do_pano, float xoffs, int do_buckets); +void project_renderdata(struct Render *re, void (*projectfunc)(const float *, float mat[][4], float *), int do_pano, float xoffs, int do_buckets); int clip_render_object(float boundbox[][3], float *bounds, float mat[][4]); /* functions are not exported... so wrong names */ diff --git a/source/blender/render/intern/include/shading.h b/source/blender/render/intern/include/shading.h index 07d24ea6d66..75d76c8ae23 100644 --- a/source/blender/render/intern/include/shading.h +++ b/source/blender/render/intern/include/shading.h @@ -63,7 +63,7 @@ void shade_volume_loop(struct ShadeInput *shi, struct ShadeResult *shr); void shade_input_set_triangle_i(struct ShadeInput *shi, struct ObjectInstanceRen *obi, struct VlakRen *vlr, short i1, short i2, short i3); void shade_input_set_triangle(struct ShadeInput *shi, volatile int obi, volatile int facenr, int normal_flip); void shade_input_copy_triangle(struct ShadeInput *shi, struct ShadeInput *from); -void shade_input_calc_viewco(struct ShadeInput *shi, float x, float y, float z, float *view, float *dxyview, float *co, float *dxco, float *dyco); +void shade_input_calc_viewco(struct ShadeInput *shi, float x, float y, float z, float view[3], float *dxyview, float *co, float *dxco, float *dyco); void shade_input_set_viewco(struct ShadeInput *shi, float x, float y, float sx, float sy, float z); void shade_input_set_uv(struct ShadeInput *shi); void shade_input_set_normals(struct ShadeInput *shi); diff --git a/source/blender/render/intern/include/zbuf.h b/source/blender/render/intern/include/zbuf.h index 4c87520d4d1..0d129081d62 100644 --- a/source/blender/render/intern/include/zbuf.h +++ b/source/blender/render/intern/include/zbuf.h @@ -51,9 +51,9 @@ void fillrect(int *rect, int x, int y, int val); * Converts a world coordinate into a homogenous coordinate in view * coordinates. */ -void projectvert(float *v1, float winmat[][4], float *adr); -void projectverto(float *v1, float winmat[][4], float *adr); -int testclip(float *v); +void projectvert(const float v1[3], float winmat[][4], float adr[4]); +void projectverto(const float v1[3], float winmat[][4], float adr[4]); +int testclip(const float v[3]); void zbuffer_shadow(struct Render *re, float winmat[][4], struct LampRen *lar, int *rectz, int size, float jitx, float jity); void zbuffer_abuf_shadow(struct Render *re, struct LampRen *lar, float winmat[][4], struct APixstr *APixbuf, struct APixstrand *apixbuf, struct ListBase *apsmbase, int size, int samples, float (*jit)[2]); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index c347de6fb4b..e1706ac25b2 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -142,7 +142,7 @@ static HaloRen *initstar(Render *re, ObjectRen *obr, float *vec, float hasize) har= RE_findOrAddHalo(obr, obr->tothalo++); /* projectvert is done in function zbufvlaggen again, because of parts */ - VECCOPY(har->co, vec); + copy_v3_v3(har->co, vec); har->hasize= hasize; har->zd= 0.0; @@ -547,7 +547,7 @@ static void GetPosition(const SMikkTSpaceContext * pContext, float fPos[], const SRenderMeshToTangent * pMesh = (SRenderMeshToTangent *) pContext->m_pUserData; VlakRen *vlr= RE_findOrAddVlak(pMesh->obr, face_num); const float *co= (&vlr->v1)[vert_index]->co; - VECCOPY(fPos, co); + copy_v3_v3(fPos, co); } static void GetTextureCoordinate(const SMikkTSpaceContext * pContext, float fUV[], const int face_num, const int vert_index) @@ -576,7 +576,7 @@ static void GetNormal(const SMikkTSpaceContext * pContext, float fNorm[], const SRenderMeshToTangent * pMesh = (SRenderMeshToTangent *) pContext->m_pUserData; VlakRen *vlr= RE_findOrAddVlak(pMesh->obr, face_num); const float *n= (&vlr->v1)[vert_index]->n; - VECCOPY(fNorm, n); + copy_v3_v3(fNorm, n); } static void SetTSpace(const SMikkTSpaceContext * pContext, const float fvTangent[], const float fSign, const int face_num, const int iVert) { @@ -585,7 +585,7 @@ static void SetTSpace(const SMikkTSpaceContext * pContext, const float fvTangent VlakRen *vlr= RE_findOrAddVlak(pMesh->obr, face_num); float * ftang= RE_vlakren_get_nmap_tangent(pMesh->obr, vlr, 1); if(ftang!=NULL) { - VECCOPY(&ftang[iVert*4+0], fvTangent); + copy_v3_v3(&ftang[iVert*4+0], fvTangent); ftang[iVert*4+3]=fSign; } } @@ -632,10 +632,10 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen VlakRen *vlr= RE_findOrAddVlak(obr, a); if((vlr->flag & ME_SMOOTH)==0) { - if(is_zero_v3(vlr->v1->n)) VECCOPY(vlr->v1->n, vlr->n); - if(is_zero_v3(vlr->v2->n)) VECCOPY(vlr->v2->n, vlr->n); - if(is_zero_v3(vlr->v3->n)) VECCOPY(vlr->v3->n, vlr->n); - if(vlr->v4 && is_zero_v3(vlr->v4->n)) VECCOPY(vlr->v4->n, vlr->n); + if(is_zero_v3(vlr->v1->n)) copy_v3_v3(vlr->v1->n, vlr->n); + if(is_zero_v3(vlr->v2->n)) copy_v3_v3(vlr->v2->n, vlr->n); + if(is_zero_v3(vlr->v3->n)) copy_v3_v3(vlr->v3->n, vlr->n); + if(vlr->v4 && is_zero_v3(vlr->v4->n)) copy_v3_v3(vlr->v4->n, vlr->n); } if(do_nmap_tangent) { @@ -647,17 +647,17 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen float *vtang, *ftang= RE_vlakren_get_nmap_tangent(obr, vlr, 1); vtang= find_vertex_tangent(vtangents[v1->index], tface->uv[0]); - VECCOPY(ftang, vtang); + copy_v3_v3(ftang, vtang); normalize_v3(ftang); vtang= find_vertex_tangent(vtangents[v2->index], tface->uv[1]); - VECCOPY(ftang+4, vtang); + copy_v3_v3(ftang+4, vtang); normalize_v3(ftang+4); vtang= find_vertex_tangent(vtangents[v3->index], tface->uv[2]); - VECCOPY(ftang+8, vtang); + copy_v3_v3(ftang+8, vtang); normalize_v3(ftang+8); if(v4) { vtang= find_vertex_tangent(vtangents[v4->index], tface->uv[3]); - VECCOPY(ftang+12, vtang); + copy_v3_v3(ftang+12, vtang); normalize_v3(ftang+12); } for(k=0; k<4; k++) ftang[4*k+3]=1; @@ -1023,7 +1023,7 @@ typedef struct ParticleStrandData } ParticleStrandData; /* future thread problem... */ -static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, ParticleStrandData *sd, float *vec, float *vec1) +static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, ParticleStrandData *sd, const float vec[3], const float vec1[3]) { static VertRen *v1= NULL, *v2= NULL; VlakRen *vlr= NULL; @@ -1090,27 +1090,27 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par vlr->v3= RE_findOrAddVert(obr, obr->totvert++); vlr->v4= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(vlr->v1->co, vec); + copy_v3_v3(vlr->v1->co, vec); add_v3_v3(vlr->v1->co, cross); - VECCOPY(vlr->v1->n, nor); + copy_v3_v3(vlr->v1->n, nor); vlr->v1->orco= sd->orco; vlr->v1->accum= -1.0f; // accum abuse for strand texco - VECCOPY(vlr->v2->co, vec); + copy_v3_v3(vlr->v2->co, vec); sub_v3_v3v3(vlr->v2->co, vlr->v2->co, cross); - VECCOPY(vlr->v2->n, nor); + copy_v3_v3(vlr->v2->n, nor); vlr->v2->orco= sd->orco; vlr->v2->accum= vlr->v1->accum; - VECCOPY(vlr->v4->co, vec1); + copy_v3_v3(vlr->v4->co, vec1); add_v3_v3(vlr->v4->co, cross); - VECCOPY(vlr->v4->n, nor); + copy_v3_v3(vlr->v4->n, nor); vlr->v4->orco= sd->orco; vlr->v4->accum= 1.0f; // accum abuse for strand texco - VECCOPY(vlr->v3->co, vec1); + copy_v3_v3(vlr->v3->co, vec1); sub_v3_v3v3(vlr->v3->co, vlr->v3->co, cross); - VECCOPY(vlr->v3->n, nor); + copy_v3_v3(vlr->v3->n, nor); vlr->v3->orco= sd->orco; vlr->v3->accum= vlr->v4->accum; @@ -1121,7 +1121,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par if(sd->surfnor) { float *snor= RE_vlakren_get_surfnor(obr, vlr, 1); - VECCOPY(snor, sd->surfnor); + copy_v3_v3(snor, sd->surfnor); } if(sd->uvco){ @@ -1156,23 +1156,23 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par /* first two vertices of a strand */ else if(sd->first) { if(sd->adapt){ - VECCOPY(anor, nor); - VECCOPY(avec, vec); + copy_v3_v3(anor, nor); + copy_v3_v3(avec, vec); second=1; } v1= RE_findOrAddVert(obr, obr->totvert++); v2= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(v1->co, vec); + copy_v3_v3(v1->co, vec); add_v3_v3(v1->co, cross); - VECCOPY(v1->n, nor); + copy_v3_v3(v1->n, nor); v1->orco= sd->orco; v1->accum= -1.0f; // accum abuse for strand texco - VECCOPY(v2->co, vec); + copy_v3_v3(v2->co, vec); sub_v3_v3v3(v2->co, v2->co, cross); - VECCOPY(v2->n, nor); + copy_v3_v3(v2->n, nor); v2->orco= sd->orco; v2->accum= v1->accum; } @@ -1192,8 +1192,8 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par if(sd->adapt){ second=0; - VECCOPY(anor,nor); - VECCOPY(avec,vec); + copy_v3_v3(anor,nor); + copy_v3_v3(avec,vec); } } @@ -1218,23 +1218,23 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par v1= vlr->v4; // cycle v2= vlr->v3; // cycle - VECCOPY(anor,nor); - VECCOPY(avec,vec); + copy_v3_v3(anor,nor); + copy_v3_v3(avec,vec); } else{ vlr= RE_findOrAddVlak(obr, obr->totvlak-1); } } - VECCOPY(vlr->v4->co, vec); + copy_v3_v3(vlr->v4->co, vec); add_v3_v3(vlr->v4->co, cross); - VECCOPY(vlr->v4->n, nor); + copy_v3_v3(vlr->v4->n, nor); vlr->v4->orco= sd->orco; vlr->v4->accum= -1.0f + 2.0f*sd->time; // accum abuse for strand texco - VECCOPY(vlr->v3->co, vec); + copy_v3_v3(vlr->v3->co, vec); sub_v3_v3v3(vlr->v3->co, vlr->v3->co, cross); - VECCOPY(vlr->v3->n, nor); + copy_v3_v3(vlr->v3->n, nor); vlr->v3->orco= sd->orco; vlr->v3->accum= vlr->v4->accum; @@ -1245,7 +1245,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par if(sd->surfnor) { float *snor= RE_vlakren_get_surfnor(obr, vlr, 1); - VECCOPY(snor, sd->surfnor); + copy_v3_v3(snor, sd->surfnor); } if(sd->uvco){ @@ -1279,7 +1279,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par } } -static void static_particle_wire(ObjectRen *obr, Material *ma, float *vec, float *vec1, int first, int line) +static void static_particle_wire(ObjectRen *obr, Material *ma, const float vec[3], const float vec1[3], int first, int line) { VlakRen *vlr; static VertRen *v1; @@ -1291,13 +1291,13 @@ static void static_particle_wire(ObjectRen *obr, Material *ma, float *vec, float vlr->v3= vlr->v2; vlr->v4= NULL; - VECCOPY(vlr->v1->co, vec); - VECCOPY(vlr->v2->co, vec1); + copy_v3_v3(vlr->v1->co, vec); + copy_v3_v3(vlr->v2->co, vec1); sub_v3_v3v3(vlr->n, vec, vec1); normalize_v3(vlr->n); - VECCOPY(vlr->v1->n, vlr->n); - VECCOPY(vlr->v2->n, vlr->n); + copy_v3_v3(vlr->v1->n, vlr->n); + copy_v3_v3(vlr->v2->n, vlr->n); vlr->mat= ma; vlr->ec= ME_V1V2; @@ -1305,7 +1305,7 @@ static void static_particle_wire(ObjectRen *obr, Material *ma, float *vec, float } else if(first) { v1= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(v1->co, vec); + copy_v3_v3(v1->co, vec); } else { vlr= RE_findOrAddVlak(obr, obr->totvlak++); @@ -1315,11 +1315,11 @@ static void static_particle_wire(ObjectRen *obr, Material *ma, float *vec, float vlr->v4= NULL; v1= vlr->v2; // cycle - VECCOPY(v1->co, vec); + copy_v3_v3(v1->co, vec); sub_v3_v3v3(vlr->n, vec, vec1); normalize_v3(vlr->n); - VECCOPY(v1->n, vlr->n); + copy_v3_v3(v1->n, vlr->n); vlr->mat= ma; vlr->ec= ME_V1V2; @@ -1376,10 +1376,10 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl mul_m4_v3(re->viewmat, vlr->v4->co); normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co); - VECCOPY(vlr->v1->n,vlr->n); - VECCOPY(vlr->v2->n,vlr->n); - VECCOPY(vlr->v3->n,vlr->n); - VECCOPY(vlr->v4->n,vlr->n); + copy_v3_v3(vlr->v1->n,vlr->n); + copy_v3_v3(vlr->v2->n,vlr->n); + copy_v3_v3(vlr->v3->n,vlr->n); + copy_v3_v3(vlr->v4->n,vlr->n); vlr->mat= ma; vlr->ec= ME_V2V3; @@ -1470,7 +1470,7 @@ static void particle_normal_ren(short ren_as, ParticleSettings *part, Render *re { float loc[3], loc0[3], loc1[3], vel[3]; - VECCOPY(loc, state->co); + copy_v3_v3(loc, state->co); if(ren_as != PART_DRAW_BB) mul_m4_v3(re->viewmat, loc); @@ -1481,7 +1481,7 @@ static void particle_normal_ren(short ren_as, ParticleSettings *part, Render *re sd->time = 0.0f; sd->size = hasize; - VECCOPY(vel, state->vel); + copy_v3_v3(vel, state->vel); mul_mat3_m4_v3(re->viewmat, vel); normalize_v3(vel); @@ -1497,8 +1497,8 @@ static void particle_normal_ren(short ren_as, ParticleSettings *part, Render *re case PART_DRAW_BB: - VECCOPY(bb->vec, loc); - VECCOPY(bb->vel, state->vel); + copy_v3_v3(bb->vec, loc); + copy_v3_v3(bb->vel, state->vel); particle_billboard(re, obr, ma, bb); @@ -1892,7 +1892,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem strand= RE_findOrAddStrand(obr, obr->totstrand++); strand->buffer= strandbuf; strand->vert= svert; - VECCOPY(strand->orco, sd.orco); + copy_v3_v3(strand->orco, sd.orco); if(dosimplify) { float *ssimplify= RE_strandren_get_simplify(obr, strand, 1); @@ -1902,7 +1902,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem if(sd.surfnor) { float *snor= RE_strandren_get_surfnor(obr, strand, 1); - VECCOPY(snor, sd.surfnor); + copy_v3_v3(snor, sd.surfnor); } if(dosurfacecache && num >= 0) { @@ -1945,8 +1945,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem float time; if(k<=max_k){ - VECCOPY(state.co,(cache+k)->co); - VECCOPY(state.vel,(cache+k)->vel); + copy_v3_v3(state.co,(cache+k)->co); + copy_v3_v3(state.vel,(cache+k)->vel); } else continue; @@ -1955,11 +1955,11 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem curlen += len_v3v3((cache+k-1)->co, (cache+k)->co); time= curlen/strandlen; - VECCOPY(loc,state.co); + copy_v3_v3(loc,state.co); mul_m4_v3(re->viewmat,loc); if(strandbuf) { - VECCOPY(svert->co, loc); + copy_v3_v3(svert->co, loc); svert->strandco= -1.0f + 2.0f*time; svert++; strand->totvert++; @@ -1982,7 +1982,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem if(k) particle_curve(re, obr, psmd->dm, ma, &sd, loc, loc1, seed, pa_co); - VECCOPY(loc1,loc); + copy_v3_v3(loc1,loc); } } @@ -2147,7 +2147,7 @@ static void make_render_halos(Render *re, ObjectRen *obr, Mesh *UNUSED(me), int if(ok) { hasize= ma->hasize; - VECCOPY(vec, mvert->co); + copy_v3_v3(vec, mvert->co); mul_m4_v3(mat, vec); if(ma->mode & MA_HALOPUNO) { @@ -2161,7 +2161,7 @@ static void make_render_halos(Render *re, ObjectRen *obr, Mesh *UNUSED(me), int nor[2]= imat[2][0]*xn+imat[2][1]*yn+imat[2][2]*zn; normalize_v3(nor); - VECCOPY(view, vec); + copy_v3_v3(view, vec); normalize_v3(view); zn= nor[0]*view[0]+nor[1]*view[1]+nor[2]*view[2]; @@ -2238,9 +2238,9 @@ static void displace_render_vert(Render *re, ObjectRen *obr, ShadeInput *shi, Ve int i; /* shi->co is current render coord, just make sure at least some vector is here */ - VECCOPY(shi->co, vr->co); + copy_v3_v3(shi->co, vr->co); /* vertex normal is used for textures type 'col' and 'var' */ - VECCOPY(shi->vn, vr->n); + copy_v3_v3(shi->vn, vr->n); if(mat) mul_m4_v3(mat, shi->co); @@ -2269,7 +2269,7 @@ static void displace_render_vert(Render *re, ObjectRen *obr, ShadeInput *shi, Ve /* set all rendercoords, 'texco' is an ORed value for all textures needed */ if ((texco & TEXCO_ORCO) && (vr->orco)) { - VECCOPY(shi->lo, vr->orco); + copy_v3_v3(shi->lo, vr->orco); } if (texco & TEXCO_STICKY) { float *sticky= RE_vertren_get_sticky(obr, vr, 0); @@ -2280,11 +2280,11 @@ static void displace_render_vert(Render *re, ObjectRen *obr, ShadeInput *shi, Ve } } if (texco & TEXCO_GLOB) { - VECCOPY(shi->gl, shi->co); + copy_v3_v3(shi->gl, shi->co); mul_m4_v3(re->viewinv, shi->gl); } if (texco & TEXCO_NORM) { - VECCOPY(shi->orn, shi->vn); + copy_v3_v3(shi->orn, shi->vn); } if(texco & TEXCO_REFL) { /* not (yet?) */ @@ -2461,7 +2461,7 @@ static void init_render_mball(Render *re, ObjectRen *obr) for(a=0; a<dl->nr; a++, data+=3, nors+=3) { ver= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(ver->co, data); + copy_v3_v3(ver->co, data); mul_m4_v3(mat, ver->co); /* render normals are inverted */ @@ -2540,7 +2540,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar, data= dl->verts; for (u = 0; u < sizeu; u++) { v1 = RE_findOrAddVert(obr, obr->totvert++); /* save this for possible V wrapping */ - VECCOPY(v1->co, data); data += 3; + copy_v3_v3(v1->co, data); data += 3; if(orco) { v1->orco= orco; orco+= 3; orcoret++; } @@ -2548,7 +2548,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar, for (v = 1; v < sizev; v++) { ver= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(ver->co, data); data += 3; + copy_v3_v3(ver->co, data); data += 3; if(orco) { ver->orco= orco; orco+= 3; orcoret++; } @@ -2557,7 +2557,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar, /* if V-cyclic, add extra vertices at end of the row */ if (dl->flag & DL_CYCL_U) { ver= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(ver->co, v1->co); + copy_v3_v3(ver->co, v1->co); if(orco) { ver->orco= orco; orco+=3; orcoret++; //orcobase + 3*(u*sizev + 0); } @@ -2573,7 +2573,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar, for (v = 0; v < nsizev; v++) { v1= RE_findOrAddVert(obr, startvert + v); ver= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(ver->co, v1->co); + copy_v3_v3(ver->co, v1->co); if(orco) { ver->orco= orco; orco+=3; orcoret++; //ver->orco= orcobase + 3*(0*sizev + v); } @@ -2602,7 +2602,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar, normal_quad_v3( n1,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co); - VECCOPY(vlr->n, n1); + copy_v3_v3(vlr->n, n1); vlr->mat= matar[ dl->col]; vlr->ec= ME_V1V2+ME_V2V3; @@ -2670,10 +2670,10 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar, add_v3_v3(n1, vlr2->n); vlr3= RE_findOrAddVlak(obr, UVTOINDEX(sizeu-1, 0)); /* (m,0) */ add_v3_v3(n1, vlr3->n); - VECCOPY(vlr->v3->n, n1); - VECCOPY(vlr1->v1->n, n1); - VECCOPY(vlr2->v2->n, n1); - VECCOPY(vlr3->v4->n, n1); + copy_v3_v3(vlr->v3->n, n1); + copy_v3_v3(vlr1->v1->n, n1); + copy_v3_v3(vlr2->v2->n, n1); + copy_v3_v3(vlr3->v4->n, n1); } for(a = startvert; a < obr->totvert; a++) { ver= RE_findOrAddVert(obr, a); @@ -2701,7 +2701,7 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr, for(a=0; a<totvert; a++, mvert++) { ver= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(ver->co, mvert->co); + copy_v3_v3(ver->co, mvert->co); mul_m4_v3(mat, ver->co); if(orco) { @@ -2913,7 +2913,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset) for(a=0; a<dl->nr; a++, data+=3) { ver= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(ver->co, data); + copy_v3_v3(ver->co, data); mul_m4_v3(mat, ver->co); @@ -2979,7 +2979,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset) while(nr--) { ver= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(ver->co, fp); + copy_v3_v3(ver->co, fp); mul_m4_v3(mat, ver->co); fp+= 3; @@ -3340,7 +3340,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset) for(a=0; a<totvert; a++, mvert++) { ver= RE_findOrAddVert(obr, obr->totvert++); - VECCOPY(ver->co, mvert->co); + copy_v3_v3(ver->co, mvert->co); if(do_autosmooth==0) { /* autosmooth on original unrotated data to prevent differences between frames */ normal_short_to_float_v3(ver->n, mvert->no); mul_m4_v3(mat, ver->co); @@ -3782,7 +3782,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob) lar->sunsky = (struct SunSky*)MEM_callocN(sizeof(struct SunSky), "sunskyren"); lar->sunsky->effect_type = la->sun_effect_type; - VECCOPY(vec,ob->obmat[2]); + copy_v3_v3(vec,ob->obmat[2]); normalize_v3(vec); InitSunSky(lar->sunsky, la->atm_turbidity, vec, la->horizon_brightness, @@ -4001,7 +4001,7 @@ void init_render_world(Render *re) cp[2]= 255.0f*re->wrld.horb; cp[3]= 1; - VECCOPY(re->grvec, re->viewmat[2]); + copy_v3_v3(re->grvec, re->viewmat[2]); normalize_v3(re->grvec); copy_m3_m4(re->imat, re->viewinv); @@ -4051,25 +4051,25 @@ static void set_phong_threshold(ObjectRen *obr) for(i=0; i<obr->totvlak; i++) { vlr= RE_findOrAddVlak(obr, i); if(vlr->flag & R_SMOOTH) { - dot= INPR(vlr->n, vlr->v1->n); + dot= dot_v3v3(vlr->n, vlr->v1->n); dot= ABS(dot); if(dot>0.9f) { thresh+= dot; tot++; } - dot= INPR(vlr->n, vlr->v2->n); + dot= dot_v3v3(vlr->n, vlr->v2->n); dot= ABS(dot); if(dot>0.9f) { thresh+= dot; tot++; } - dot= INPR(vlr->n, vlr->v3->n); + dot= dot_v3v3(vlr->n, vlr->v3->n); dot= ABS(dot); if(dot>0.9f) { thresh+= dot; tot++; } if(vlr->v4) { - dot= INPR(vlr->n, vlr->v4->n); + dot= dot_v3v3(vlr->n, vlr->v4->n); dot= ABS(dot); if(dot>0.9f) { thresh+= dot; tot++; @@ -4340,16 +4340,16 @@ static void finalize_render_object(Render *re, ObjectRen *obr, int timeoffset) strand_minmax(strand, smin, smax, width); } - VECCOPY(sbound->boundbox[0], smin); - VECCOPY(sbound->boundbox[1], smax); + copy_v3_v3(sbound->boundbox[0], smin); + copy_v3_v3(sbound->boundbox[1], smax); DO_MINMAX(smin, min, max); DO_MINMAX(smax, min, max); } } - VECCOPY(obr->boundbox[0], min); - VECCOPY(obr->boundbox[1], max); + copy_v3_v3(obr->boundbox[0], min); + copy_v3_v3(obr->boundbox[1], max); } } } @@ -4932,7 +4932,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp /* fill in instance variables for texturing */ set_dupli_tex_mat(re, obi, dob); if(dob->type != OB_DUPLIGROUP) { - VECCOPY(obi->dupliorco, dob->orco); + copy_v3_v3(obi->dupliorco, dob->orco); obi->dupliuv[0]= dob->uv[0]; obi->dupliuv[1]= dob->uv[1]; } @@ -4958,7 +4958,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp set_dupli_tex_mat(re, obi, dob); if(dob->type != OB_DUPLIGROUP) { - VECCOPY(obi->dupliorco, dob->orco); + copy_v3_v3(obi->dupliorco, dob->orco); obi->dupliuv[0]= dob->uv[0]; obi->dupliuv[1]= dob->uv[1]; } @@ -5064,7 +5064,7 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l /* still bad... doing all */ init_render_textures(re); - VECCOPY(amb, &re->wrld.ambr); + copy_v3_v3(amb, &re->wrld.ambr); init_render_materials(re->main, re->r.mode, amb); set_node_shader_lamp_loop(shade_material_loop); @@ -5216,7 +5216,7 @@ static void database_fromscene_vectors(Render *re, Scene *scene, unsigned int la } /* choose to use static, to prevent giving too many args to this call */ -static void speedvector_project(Render *re, float *zco, float *co, float *ho) +static void speedvector_project(Render *re, float zco[2], const float co[3], const float ho[4]) { static float pixelphix=0.0f, pixelphiy=0.0f, zmulx=0.0f, zmuly=0.0f; static int pano= 0; @@ -5251,7 +5251,7 @@ static void speedvector_project(Render *re, float *zco, float *co, float *ho) if(pano) { float vec[3], ang; /* angle between (0,0,-1) and (co) */ - VECCOPY(vec, co); + copy_v3_v3(vec, co); ang= saacos(-vec[2]/sqrt(vec[0]*vec[0] + vec[2]*vec[2])); if(vec[0]<0.0f) ang= -ang; @@ -5267,7 +5267,7 @@ static void speedvector_project(Render *re, float *zco, float *co, float *ho) } } -static void calculate_speedvector(float *vectors, int step, float winsq, float winroot, float *co, float *ho, float *speed) +static void calculate_speedvector(const float vectors[2], int step, float winsq, float winroot, const float co[3], const float ho[4], float speed[4]) { float zco[2], len; @@ -5764,7 +5764,7 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay, /* still bad... doing all */ init_render_textures(re); - VECCOPY(amb, &re->wrld.ambr); + copy_v3_v3(amb, &re->wrld.ambr); init_render_materials(re->main, re->r.mode, amb); set_node_shader_lamp_loop(shade_material_loop); @@ -5860,7 +5860,7 @@ void RE_make_sticky(Scene *scene, View3D *v3d) ms= me->msticky; for(a=0; a<me->totvert; a++, ms++, mvert++) { - VECCOPY(ho, mvert->co); + copy_v3_v3(ho, mvert->co); mul_m4_v3(mat, ho); projectverto(ho, re->winmat, ho); ms->co[0]= ho[0]/ho[3]; diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index cf1fae81eb5..4a8db693b76 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -2526,7 +2526,7 @@ void do_material_tex(ShadeInput *shi) nor[1]= Tnor*norfac*texres.nor[1]; nor[2]= Tnor*norfac*texres.nor[2]; - dot= 0.5f + 0.5f*INPR(nor, shi->vn); + dot= 0.5f + 0.5f * dot_v3v3(nor, shi->vn); shi->vn[0]+= dot*nor[0]; shi->vn[1]+= dot*nor[1]; diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index b66740c87ba..16bbe1ca5c2 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -128,7 +128,7 @@ void calc_view_vector(float *view, float x, float y) } } -void calc_renderco_ortho(float *co, float x, float y, int z) +void calc_renderco_ortho(float co[3], float x, float y, int z) { /* x and y 3d coordinate can be derived from pixel coord and winmat */ float fx= 2.0f/(R.winx*R.winmat[0][0]); @@ -142,7 +142,7 @@ void calc_renderco_ortho(float *co, float x, float y, int z) co[2]= R.winmat[3][2]/( R.winmat[2][3]*zco - R.winmat[2][2] ); } -void calc_renderco_zbuf(float *co, float *view, int z) +void calc_renderco_zbuf(float co[3], float *view, int z) { float fac, zco; diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index 0c5ad0475ab..644360520ad 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -1238,7 +1238,7 @@ static int panotestclip(Render *re, int do_pano, float *v) - shadow buffering (shadbuf.c) */ -void project_renderdata(Render *re, void (*projectfunc)(float *, float mat[][4], float *), int do_pano, float xoffs, int UNUSED(do_buckets)) +void project_renderdata(Render *re, void (*projectfunc)(const float *, float mat[][4], float *), int do_pano, float xoffs, int UNUSED(do_buckets)) { ObjectRen *obr; HaloRen *har = NULL; diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index eab66aaf2ec..a75bf5e14fd 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -369,7 +369,7 @@ void shade_input_set_strand(ShadeInput *shi, StrandRen *strand, StrandPoint *spo cross_v3_v3v3(shi->vn, cross, spoint->tan); normalize_v3(shi->vn); - if(INPR(shi->vn, shi->view) < 0.0f) + if(dot_v3v3(shi->vn, shi->view) < 0.0f) negate_v3(shi->vn); } @@ -586,7 +586,7 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert } /* from scanline pixel coordinates to 3d coordinates, requires set_triangle */ -void shade_input_calc_viewco(ShadeInput *shi, float x, float y, float z, float *view, float *dxyview, float *co, float *dxco, float *dyco) +void shade_input_calc_viewco(ShadeInput *shi, float x, float y, float z, float view[3], float dxyview[2], float co[3], float dxco[3], float dyco[3]) { /* returns not normalized, so is in viewplane coords */ calc_view_vector(view, x, y); diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 30632586b04..ab8a1934fde 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -486,8 +486,8 @@ static float area_lamp_energy_multisample(LampRen *lar, float *co, float *vn) int a= lar->ray_totsamp; /* test if co is behind lamp */ - VECSUB(vec, co, lar->co); - if(INPR(vec, lar->vec) < 0.0f) + sub_v3_v3v3(vec, co, lar->co); + if(dot_v3v3(vec, lar->vec) < 0.0f) return 0.0f; while(a--) { @@ -1125,15 +1125,15 @@ float lamp_get_visibility(LampRen *lar, float *co, float *lv, float *dist) else { float visifac= 1.0f, t; - VECSUB(lv, co, lar->co); - *dist= sqrt( INPR(lv, lv)); + sub_v3_v3v3(lv, co, lar->co); + *dist= sqrtf(dot_v3v3(lv, lv)); t= 1.0f/dist[0]; - VECMUL(lv, t); + mul_v3_fl(lv, t); /* area type has no quad or sphere option */ if(lar->type==LA_AREA) { /* area is single sided */ - //if(INPR(lv, lar->vec) > 0.0f) + //if(dot_v3v3(lv, lar->vec) > 0.0f) // visifac= 1.0f; //else // visifac= 0.0f; @@ -1179,7 +1179,7 @@ float lamp_get_visibility(LampRen *lar, float *co, float *lv, float *dist) float inpr; if(lar->mode & LA_SQUARE) { - if(lv[0]*lar->vec[0]+lv[1]*lar->vec[1]+lv[2]*lar->vec[2]>0.0f) { + if(dot_v3v3(lv, lar->vec) > 0.0f) { float lvrot[3], x; /* rotate view to lampspace */ @@ -1279,7 +1279,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int cross_v3_v3v3(cross, shi->surfnor, vn); cross_v3_v3v3(nstrand, vn, cross); - blend= INPR(nstrand, shi->surfnor); + blend= dot_v3v3(nstrand, shi->surfnor); blend= 1.0f - blend; CLAMP(blend, 0.0f, 1.0f); @@ -1314,8 +1314,8 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int /* dot product and reflectivity */ /* inp = dotproduct, is = shader result, i = lamp energy (with shadow), i_noshad = i without shadow */ - inp= vn[0]*lv[0] + vn[1]*lv[1] + vn[2]*lv[2]; - + inp= dot_v3v3(vn, lv); + /* phong threshold to prevent backfacing faces having artefacts on ray shadow (terminator problem) */ /* this complex construction screams for a nicer implementation! (ton) */ if(R.r.mode & R_SHADOW) { @@ -1383,7 +1383,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int if(lar->shb || (lar->mode & LA_SHAD_RAY)) { if(vn==vnor) /* tangent trigger */ - lamp_get_shadow(lar, shi, INPR(shi->vn, lv), shadfac, shi->depth); + lamp_get_shadow(lar, shi, dot_v3v3(shi->vn, lv), shadfac, shi->depth); else lamp_get_shadow(lar, shi, inp, shadfac, shi->depth); @@ -1531,7 +1531,7 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr) continue; } - inpr= INPR(shi->vn, lv); + inpr= dot_v3v3(shi->vn, lv); if(inpr <= 0.0f) { if (shi->mat->shadowonly_flag == MA_SO_OLD) accum+= 1.0f; @@ -1864,7 +1864,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) result[2]= shi->mirb*shi->refcol[3] + (1.0f - shi->mirb*shi->refcol[0])*shr->combined[2]; if(passflag & SCE_PASS_REFLECT) - VECSUB(shr->refl, result, shr->combined); + sub_v3_v3v3(shr->refl, result, shr->combined); if(shi->combinedflag & SCE_PASS_REFLECT) VECCOPY(shr->combined, result); diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c index 0ba13b31c4b..36b577ce9a4 100644 --- a/source/blender/render/intern/source/sss.c +++ b/source/blender/render/intern/source/sss.c @@ -394,8 +394,8 @@ static void traverse_octree(ScatterTree *tree, ScatterNode *node, float *co, int for(i=0; i<node->totpoint; i++) { ScatterPoint *p= &node->points[i]; - VECSUB(sub, co, p->co); - dist= INPR(sub, sub); + sub_v3_v3v3(sub, co, p->co); + dist= dot_v3v3(sub, sub); if(p->back) add_radiance(tree, NULL, p->rad, 0.0f, p->area, dist, result); @@ -418,8 +418,8 @@ static void traverse_octree(ScatterTree *tree, ScatterNode *node, float *co, int } else { /* decide subnode traversal based on maximum solid angle */ - VECSUB(sub, co, subnode->co); - dist= INPR(sub, sub); + sub_v3_v3v3(sub, co, subnode->co); + dist= dot_v3v3(sub, sub); /* actually area/dist > error, but this avoids division */ if(subnode->area+subnode->backarea>tree->error*dist) { diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index 19bbb11e143..a5dab4adc15 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -95,7 +95,7 @@ static float vol_get_shadow(ShadeInput *shi, LampRen *lar, float *co) is.dir[2] = -lar->vec[2]; is.dist = R.maxdist; } else { - VECSUB( is.dir, lar->co, is.start ); + sub_v3_v3v3(is.dir, lar->co, is.start); is.dist = normalize_v3( is.dir ); } diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index 925f8529dfa..ba922620ee1 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -239,7 +239,7 @@ static short cliptestf(float p, float q, float *u1, float *u2) return 1; } -int testclip(float *v) +int testclip(const float v[3]) { float abs4; /* WATCH IT: this function should do the same as cliptestf, otherwise troubles in zbufclip()*/ short c=0; @@ -1692,7 +1692,7 @@ static void makevertpyra(float *vez, float *labda, float **trias, float *v1, flo /* ------------------------------------------------------------------------- */ -void projectverto(float *v1, float winmat[][4], float *adr) +void projectverto(const float v1[3], float winmat[][4], float adr[4]) { /* calcs homogenic coord of vertex v1 */ float x,y,z; @@ -1710,7 +1710,7 @@ void projectverto(float *v1, float winmat[][4], float *adr) /* ------------------------------------------------------------------------- */ -void projectvert(float *v1, float winmat[][4], float *adr) +void projectvert(const float v1[3], float winmat[][4], float adr[4]) { /* calcs homogenic coord of vertex v1 */ float x,y,z; diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index 21a725124ad..29cbeb84058 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -256,7 +256,7 @@ static void wm_drop_operator_draw(char *name, int x, int y) glColor4ub(0, 0, 0, 50); - uiSetRoundBox(15+16); + uiSetRoundBox(UI_CNR_ALL | UI_RB_ALPHA); uiRoundBox(x, y, x + width + 8, y + 15, 4); glColor4ub(255, 255, 255, 255); |