diff options
-rw-r--r-- | source/blender/editors/space_graph/graph_draw.c | 28 | ||||
-rw-r--r-- | source/blender/imbuf/intern/radiance_hdr.c | 2 | ||||
-rw-r--r-- | source/blender/nodes/composite/node_composite_util.c | 8 | ||||
-rw-r--r-- | source/blender/nodes/composite/nodes/node_composite_colorSpill.c | 14 | ||||
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_types.c | 46 | ||||
-rw-r--r-- | source/blender/render/intern/source/sunsky.c | 80 | ||||
-rw-r--r-- | source/blender/render/intern/source/volume_precache.c | 10 |
7 files changed, 91 insertions, 97 deletions
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 279e6ce0400..25998e7bce2 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -73,18 +73,10 @@ * drawing components for some F-Curve (fcu) * - selected F-Curves should be more visible than partially visible ones */ -#define drawFCurveFade(fcu) ( ((fcu)->flag & FCURVE_SELECTED)? 1.0f : U.fcu_inactive_alpha ) - -/* set the color for some point from some value given packed into an int - * - intV: integer value containing color info packed into an int - * - alpha: float value describing the - */ -#define cpackA(intVC, alpha) \ - { \ - float _cpackCol[3]; \ - cpack_to_rgb(intVC, &_cpackCol[0], &_cpackCol[1], &_cpackCol[2]); \ - glColor4f(_cpackCol[0], _cpackCol[1], _cpackCol[2], alpha); \ - } +static float fcurve_display_alpha(FCurve *fcu) +{ + return (fcu->flag & FCURVE_SELECTED) ? 1.0f : U.fcu_inactive_alpha; +} /* *************************** */ /* F-Curve Modifier Drawing */ @@ -263,7 +255,7 @@ static void draw_fcurve_vertices_handles (FCurve *fcu, SpaceIpo *sipo, View2D *v static void set_fcurve_vertex_color (FCurve *fcu, short sel) { /* Fade the 'intensity' of the vertices based on the selection of the curves too */ - int alphaOffset= (int)((drawFCurveFade(fcu) - 1.0f) * 255); + int alphaOffset= (int)((fcurve_display_alpha(fcu) - 1.0f) * 255); /* Set color of curve vertex based on state of curve (i.e. 'Edit' Mode) */ if ((fcu->flag & FCURVE_PROTECTED)==0) { @@ -369,7 +361,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu) /* only draw first handle if previous segment had handles */ if ((!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ))) { UI_GetThemeColor3ubv(basecol + bezt->h1, col); - col[3]= drawFCurveFade(fcu) * 255; + col[3]= fcurve_display_alpha(fcu) * 255; glColor4ubv((GLubyte *)col); glVertex2fv(fp); glVertex2fv(fp+3); @@ -378,7 +370,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu) /* only draw second handle if this segment is bezier */ if (bezt->ipo == BEZT_IPO_BEZ) { UI_GetThemeColor3ubv(basecol + bezt->h2, col); - col[3]= drawFCurveFade(fcu) * 255; + col[3]= fcurve_display_alpha(fcu) * 255; glColor4ubv((GLubyte *)col); glVertex2fv(fp+3); glVertex2fv(fp+6); @@ -391,7 +383,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu) { fp= bezt->vec[0]; UI_GetThemeColor3ubv(basecol + bezt->h1, col); - col[3]= drawFCurveFade(fcu) * 255; + col[3]= fcurve_display_alpha(fcu) * 255; glColor4ubv((GLubyte *)col); glVertex2fv(fp); glVertex2fv(fp+3); @@ -403,7 +395,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu) { fp= bezt->vec[1]; UI_GetThemeColor3ubv(basecol + bezt->h2, col); - col[3]= drawFCurveFade(fcu) * 255; + col[3]= fcurve_display_alpha(fcu) * 255; glColor4ubv((GLubyte *)col); glVertex2fv(fp); glVertex2fv(fp+3); @@ -867,7 +859,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri /* set whatever color the curve has set * - unselected curves draw less opaque to help distinguish the selected ones */ - glColor4f(fcu->color[0], fcu->color[1], fcu->color[2], drawFCurveFade(fcu)); + glColor4f(fcu->color[0], fcu->color[1], fcu->color[2], fcurve_display_alpha(fcu)); } /* draw active F-Curve thicker than the rest to make it stand out */ diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c index 5b093dc6cac..524f96b72af 100644 --- a/source/blender/imbuf/intern/radiance_hdr.c +++ b/source/blender/imbuf/intern/radiance_hdr.c @@ -43,7 +43,7 @@ #include "MEM_guardedalloc.h" -#include "BLI_blenlib.h" +#include "BLI_fileops.h" #include "imbuf.h" diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c index 8e98c055157..ab3a363e703 100644 --- a/source/blender/nodes/composite/node_composite_util.c +++ b/source/blender/nodes/composite/node_composite_util.c @@ -881,12 +881,12 @@ static void FHT2D(fREAL *data, unsigned int Mx, unsigned int My, else { // rectangular unsigned int k, Nym = Ny-1, stm = 1 << (Mx + My); for (i=0; stm>0; i++) { - #define pred(k) (((k & Nym) << Mx) + (k >> My)) - for (j=pred(i); j>i; j=pred(j)); + #define PRED(k) (((k & Nym) << Mx) + (k >> My)) + for (j=PRED(i); j>i; j=PRED(j)); if (j < i) continue; - for (k=i, j=pred(i); j!=i; k=j, j=pred(j), stm--) + for (k=i, j=PRED(i); j!=i; k=j, j=PRED(j), stm--) { t=data[j], data[j]=data[k], data[k]=t; } - #undef pred + #undef PRED stm--; } } diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c index 026d74aafc4..46d7c620aa8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c @@ -33,7 +33,7 @@ #include "node_composite_util.h" -#define avg(a,b) ((a+b)/2) +#define AVG(a, b) ((a + b) / 2) /* ******************* Color Spill Supression ********************************* */ static bNodeSocketTemplate cmp_node_color_spill_in[]={ @@ -96,7 +96,7 @@ static void do_average_spillmap_red(bNode *node, float* out, float *in) { NodeColorspill *ncs; ncs=node->storage; - out[0]=in[0]-(ncs->limscale * avg(in[1], in[2]) ); + out[0]=in[0]-(ncs->limscale * AVG(in[1], in[2]) ); } static void do_average_spillmap_red_fac(bNode *node, float* out, float *in, float *fac) @@ -104,14 +104,14 @@ static void do_average_spillmap_red_fac(bNode *node, float* out, float *in, floa NodeColorspill *ncs; ncs=node->storage; - out[0] = *fac * (in[0]-(ncs->limscale * avg(in[1], in[2]) )); + out[0] = *fac * (in[0]-(ncs->limscale * AVG(in[1], in[2]) )); } static void do_average_spillmap_green(bNode *node, float* out, float *in) { NodeColorspill *ncs; ncs=node->storage; - out[0]=in[1]-(ncs->limscale * avg(in[0], in[2]) ); + out[0]=in[1]-(ncs->limscale * AVG(in[0], in[2]) ); } static void do_average_spillmap_green_fac(bNode *node, float* out, float *in, float *fac) @@ -119,14 +119,14 @@ static void do_average_spillmap_green_fac(bNode *node, float* out, float *in, fl NodeColorspill *ncs; ncs=node->storage; - out[0] = *fac * (in[0]-(ncs->limscale * avg(in[0], in[2]) )); + out[0] = *fac * (in[0]-(ncs->limscale * AVG(in[0], in[2]) )); } static void do_average_spillmap_blue(bNode *node, float* out, float *in) { NodeColorspill *ncs; ncs=node->storage; - out[0]=in[2]-(ncs->limscale * avg(in[0], in[1]) ); + out[0]=in[2]-(ncs->limscale * AVG(in[0], in[1]) ); } static void do_average_spillmap_blue_fac(bNode *node, float* out, float *in, float *fac) @@ -134,7 +134,7 @@ static void do_average_spillmap_blue_fac(bNode *node, float* out, float *in, flo NodeColorspill *ncs; ncs=node->storage; - out[0] = *fac * (in[0]-(ncs->limscale * avg(in[0], in[1]) )); + out[0] = *fac * (in[0]-(ncs->limscale * AVG(in[0], in[1]) )); } static void do_apply_spillmap_red(bNode *node, float* out, float *in, float *map) diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index b2eed6d99d8..4b4dc7caa7f 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -2809,36 +2809,36 @@ PyObject *BPyInit_bmesh_types(void) submodule = PyModule_Create(&BPy_BM_types_module_def); -#define mod_type_add(s, t) \ +#define MODULE_TYPE_ADD(s, t) \ PyModule_AddObject(s, t.tp_name, (PyObject *)&t); Py_INCREF((PyObject *)&t) /* bmesh_py_types.c */ - mod_type_add(submodule, BPy_BMesh_Type); - mod_type_add(submodule, BPy_BMVert_Type); - mod_type_add(submodule, BPy_BMEdge_Type); - mod_type_add(submodule, BPy_BMFace_Type); - mod_type_add(submodule, BPy_BMLoop_Type); - mod_type_add(submodule, BPy_BMElemSeq_Type); - mod_type_add(submodule, BPy_BMVertSeq_Type); - mod_type_add(submodule, BPy_BMEdgeSeq_Type); - mod_type_add(submodule, BPy_BMFaceSeq_Type); - mod_type_add(submodule, BPy_BMLoopSeq_Type); - mod_type_add(submodule, BPy_BMIter_Type); + MODULE_TYPE_ADD(submodule, BPy_BMesh_Type); + MODULE_TYPE_ADD(submodule, BPy_BMVert_Type); + MODULE_TYPE_ADD(submodule, BPy_BMEdge_Type); + MODULE_TYPE_ADD(submodule, BPy_BMFace_Type); + MODULE_TYPE_ADD(submodule, BPy_BMLoop_Type); + MODULE_TYPE_ADD(submodule, BPy_BMElemSeq_Type); + MODULE_TYPE_ADD(submodule, BPy_BMVertSeq_Type); + MODULE_TYPE_ADD(submodule, BPy_BMEdgeSeq_Type); + MODULE_TYPE_ADD(submodule, BPy_BMFaceSeq_Type); + MODULE_TYPE_ADD(submodule, BPy_BMLoopSeq_Type); + MODULE_TYPE_ADD(submodule, BPy_BMIter_Type); /* bmesh_py_types_select.c */ - mod_type_add(submodule, BPy_BMEditSelSeq_Type); - mod_type_add(submodule, BPy_BMEditSelIter_Type); + MODULE_TYPE_ADD(submodule, BPy_BMEditSelSeq_Type); + MODULE_TYPE_ADD(submodule, BPy_BMEditSelIter_Type); /* bmesh_py_types_customdata.c */ - mod_type_add(submodule, BPy_BMLayerAccessVert_Type); - mod_type_add(submodule, BPy_BMLayerAccessEdge_Type); - mod_type_add(submodule, BPy_BMLayerAccessFace_Type); - mod_type_add(submodule, BPy_BMLayerAccessLoop_Type); - mod_type_add(submodule, BPy_BMLayerCollection_Type); - mod_type_add(submodule, BPy_BMLayerItem_Type); + MODULE_TYPE_ADD(submodule, BPy_BMLayerAccessVert_Type); + MODULE_TYPE_ADD(submodule, BPy_BMLayerAccessEdge_Type); + MODULE_TYPE_ADD(submodule, BPy_BMLayerAccessFace_Type); + MODULE_TYPE_ADD(submodule, BPy_BMLayerAccessLoop_Type); + MODULE_TYPE_ADD(submodule, BPy_BMLayerCollection_Type); + MODULE_TYPE_ADD(submodule, BPy_BMLayerItem_Type); /* bmesh_py_types_meshdata.c */ - mod_type_add(submodule, BPy_BMLoopUV_Type); - mod_type_add(submodule, BPy_BMDeformVert_Type); + MODULE_TYPE_ADD(submodule, BPy_BMLoopUV_Type); + MODULE_TYPE_ADD(submodule, BPy_BMDeformVert_Type); -#undef mod_type_add +#undef MODULE_TYPE_ADD return submodule; } diff --git a/source/blender/render/intern/source/sunsky.c b/source/blender/render/intern/source/sunsky.c index 1fa18c4ebb4..00370fb51bf 100644 --- a/source/blender/render/intern/source/sunsky.c +++ b/source/blender/render/intern/source/sunsky.c @@ -41,30 +41,36 @@ * compute v1 = v2 op v3 * v1, v2 and v3 are vectors contains 3 float * */ -#define vec3opv(v1, v2, op, v3) \ - v1[0] = (v2[0] op v3[0]); \ - v1[1] = (v2[1] op v3[1]);\ - v1[2] = (v2[2] op v3[2]); +#define VEC3OPV(v1, v2, op, v3) \ + { \ + v1[0] = (v2[0] op v3[0]); \ + v1[1] = (v2[1] op v3[1]); \ + v1[2] = (v2[2] op v3[2]); \ + } (void)0 /** * compute v1 = v2 op f1 * v1, v2 are vectors contains 3 float * and f1 is a float * */ -#define vec3opf(v1, v2, op, f1)\ - v1[0] = (v2[0] op (f1));\ - v1[1] = (v2[1] op (f1));\ - v1[2] = (v2[2] op (f1)); +#define VEC3OPF(v1, v2, op, f1) \ + { \ + v1[0] = (v2[0] op (f1)); \ + v1[1] = (v2[1] op (f1)); \ + v1[2] = (v2[2] op (f1)); \ + } (void)0 /** * compute v1 = f1 op v2 * v1, v2 are vectors contains 3 float * and f1 is a float * */ -#define fopvec3(v1, f1, op, v2)\ - v1[0] = ((f1) op v2[0]);\ - v1[1] = ((f1) op v2[1]);\ - v1[2] = ((f1) op v2[2]); +#define FOPVEC3(v1, f1, op, v2) \ + { \ + v1[0] = ((f1) op v2[0]); \ + v1[1] = ((f1) op v2[1]); \ + v1[2] = ((f1) op v2[2]); \ + } (void)0 /** * ClipColor: @@ -408,19 +414,19 @@ void InitAtmosphere(struct SunSky *sunSky, float sun_intens, float mief, float r fTemp = pi*pi*(n*n-1)*(n*n-1)*(6+3*pn)/(6-7*pn)/N; fBeta = 8*fTemp*pi/3; - vec3opf(sunSky->atm_BetaRay, vLambda4, *, fBeta); + VEC3OPF(sunSky->atm_BetaRay, vLambda4, *, fBeta); fBetaDash = fTemp/2; - vec3opf(sunSky->atm_BetaDashRay, vLambda4,*, fBetaDash); + VEC3OPF(sunSky->atm_BetaDashRay, vLambda4,*, fBetaDash); // Mie scattering constants. fTemp2 = 0.434f*c*(2*pi)*(2*pi)*0.5f; - vec3opf(sunSky->atm_BetaDashMie, vLambda2, *, fTemp2); + VEC3OPF(sunSky->atm_BetaDashMie, vLambda2, *, fTemp2); fTemp3 = 0.434f*c*pi*(2*pi)*(2*pi); - vec3opv(vBetaMieTemp, K, *, fLambda); - vec3opf(sunSky->atm_BetaMie, vBetaMieTemp,*, fTemp3); + VEC3OPV(vBetaMieTemp, K, *, fLambda); + VEC3OPF(sunSky->atm_BetaMie, vBetaMieTemp,*, fTemp3); } @@ -459,12 +465,12 @@ void AtmospherePixleShader( struct SunSky* sunSky, float view[3], float s, float costheta = dot_v3v3(view, sunDirection); // cos(theta) Phase_1 = 1 + (costheta * costheta); // Phase_1 - vec3opf(sunSky->atm_BetaRay, sunSky->atm_BetaRay, *, sunSky->atm_BetaRayMultiplier); - vec3opf(sunSky->atm_BetaMie, sunSky->atm_BetaMie, *, sunSky->atm_BetaMieMultiplier); - vec3opv(sunSky->atm_BetaRM, sunSky->atm_BetaRay, +, sunSky->atm_BetaMie); + VEC3OPF(sunSky->atm_BetaRay, sunSky->atm_BetaRay, *, sunSky->atm_BetaRayMultiplier); + VEC3OPF(sunSky->atm_BetaMie, sunSky->atm_BetaMie, *, sunSky->atm_BetaMieMultiplier); + VEC3OPV(sunSky->atm_BetaRM, sunSky->atm_BetaRay, +, sunSky->atm_BetaMie); //e^(-(beta_1 + beta_2) * s) = E1 - vec3opf(E1, sunSky->atm_BetaRM, *, -s/(float)M_LN2); + VEC3OPF(E1, sunSky->atm_BetaRM, *, -s/(float)M_LN2); E1[0] = exp(E1[0]); E1[1] = exp(E1[1]); E1[2] = exp(E1[2]); @@ -476,32 +482,32 @@ void AtmospherePixleShader( struct SunSky* sunSky, float view[3], float s, float fTemp = fTemp * sqrtf(fTemp); Phase_2 = (1 - sunSky->atm_HGg * sunSky->atm_HGg)/fTemp; - vec3opf(vTemp1, sunSky->atm_BetaDashRay, *, Phase_1); - vec3opf(vTemp2, sunSky->atm_BetaDashMie, *, Phase_2); + VEC3OPF(vTemp1, sunSky->atm_BetaDashRay, *, Phase_1); + VEC3OPF(vTemp2, sunSky->atm_BetaDashMie, *, Phase_2); - vec3opv(vTemp1, vTemp1, +, vTemp2); - fopvec3(vTemp2, 1.0f, -, E1); - vec3opv(vTemp1, vTemp1, *, vTemp2); + VEC3OPV(vTemp1, vTemp1, +, vTemp2); + FOPVEC3(vTemp2, 1.0f, -, E1); + VEC3OPV(vTemp1, vTemp1, *, vTemp2); - fopvec3(vTemp2, 1.0f, / , sunSky->atm_BetaRM); + FOPVEC3(vTemp2, 1.0f, / , sunSky->atm_BetaRM); - vec3opv(I, vTemp1, *, vTemp2); + VEC3OPV(I, vTemp1, *, vTemp2); - vec3opf(I, I, *, sunSky->atm_InscatteringMultiplier); - vec3opf(E, E, *, sunSky->atm_ExtinctionMultiplier); + VEC3OPF(I, I, *, sunSky->atm_InscatteringMultiplier); + VEC3OPF(E, E, *, sunSky->atm_ExtinctionMultiplier); //scale to color sun ComputeAttenuatedSunlight(sunSky->theta, sunSky->turbidity, sunColor); - vec3opv(E, E, *, sunColor); + VEC3OPV(E, E, *, sunColor); - vec3opf(I, I, *, sunSky->atm_SunIntensity); + VEC3OPF(I, I, *, sunSky->atm_SunIntensity); - vec3opv(rgb, rgb, *, E); - vec3opv(rgb, rgb, +, I); + VEC3OPV(rgb, rgb, *, E); + VEC3OPV(rgb, rgb, +, I); } -#undef vec3opv -#undef vec3opf -#undef fopvec3 +#undef VEC3OPV +#undef VEC3OPF +#undef FOPVEC3 /* EOF */ diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c index bb3ef082500..759bc622bc2 100644 --- a/source/blender/render/intern/source/volume_precache.c +++ b/source/blender/render/intern/source/volume_precache.c @@ -57,10 +57,6 @@ #include "volumetric.h" #include "volume_precache.h" -#if defined( _MSC_VER ) && !defined( __cplusplus ) -# define inline __inline -#endif // defined( _MSC_VER ) && !defined( __cplusplus ) - #include "BKE_global.h" /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ @@ -265,19 +261,19 @@ static void lightcache_filter2(VolumePrecache *vp) } #endif -static inline int ms_I(int x, int y, int z, int *n) //has a pad of 1 voxel surrounding the core for boundary simulation +BLI_INLINE int ms_I(int x, int y, int z, int *n) //has a pad of 1 voxel surrounding the core for boundary simulation { /* different ordering to light cache */ return x*(n[1]+2)*(n[2]+2) + y*(n[2]+2) + z; } -static inline int v_I_pad(int x, int y, int z, int *n) //has a pad of 1 voxel surrounding the core for boundary simulation +BLI_INLINE int v_I_pad(int x, int y, int z, int *n) //has a pad of 1 voxel surrounding the core for boundary simulation { /* same ordering to light cache, with padding */ return z*(n[1]+2)*(n[0]+2) + y*(n[0]+2) + x; } -static inline int lc_to_ms_I(int x, int y, int z, int *n) +BLI_INLINE int lc_to_ms_I(int x, int y, int z, int *n) { /* converting light cache index to multiple scattering index */ return (x-1)*(n[1]*n[2]) + (y-1)*(n[2]) + z-1; |