diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-03-22 12:30:00 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-03-22 12:30:00 +0300 |
commit | 1e9bf0cfdb6c925b28af6f0330467e7d9d798c05 (patch) | |
tree | c8356d8bc812dc6e3f23b9c381e94ec4c9d4c879 /source/blender/blenlib/intern | |
parent | 9b2dd9aac65aa49c05176bb8b7aabde9fe1aeeac (diff) |
spaces -> tabs, (4 spaces == 1 tab, only for white space preceding text)
Diffstat (limited to 'source/blender/blenlib/intern')
24 files changed, 334 insertions, 334 deletions
diff --git a/source/blender/blenlib/intern/BLI_bfile.c b/source/blender/blenlib/intern/BLI_bfile.c index 3306283ad3f..b5dd764d6c6 100644 --- a/source/blender/blenlib/intern/BLI_bfile.c +++ b/source/blender/blenlib/intern/BLI_bfile.c @@ -72,7 +72,7 @@ void setup_temp(); /*** Exported functions ***/ BFILE *BLI_bfile_fopen(const char *path, const char *mode, int bflags, - BEnvVarFam envvars) + BEnvVarFam envvars) { BFILE *bfile; @@ -107,7 +107,7 @@ BFILE *BLI_bfile_fopen(const char *path, const char *mode, int bflags, BFILE *BLI_bfile_open(const char *pathname, int flags, int bflags, - BEnvVarFam envvars) + BEnvVarFam envvars) { BFILE *bfile; @@ -171,7 +171,7 @@ ssize_t BLI_bfile_read(BFILE *f, void *buf, size_t count) { size_t BLI_bfile_fwrite(const void *ptr, size_t size, size_t nmemb, - BFILE *f) + BFILE *f) { size_t ret; @@ -389,7 +389,7 @@ void expand_envvars(char* src, char* dst) { } /* Figure the name of the env var we just found */ strncpy(name, hit1 + ENVVAR_P_SIZE, - hit2 - (hit1 + ENVVAR_P_SIZE)); + hit2 - (hit1 + ENVVAR_P_SIZE)); name[hit2 - (hit1 + ENVVAR_P_SIZE)] = '\0'; /* See if we can get something with that name */ value = getenv(name); diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index b95f276a702..82241ad2cfb 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -138,7 +138,7 @@ void *BLI_ghashIterator_getValue(GHashIterator *ghi) { void BLI_ghashIterator_step(GHashIterator *ghi) { if (ghi->curEntry) { - ghi->curEntry= ghi->curEntry->next; + ghi->curEntry= ghi->curEntry->next; while (!ghi->curEntry) { ghi->curBucket++; if (ghi->curBucket==ghi->gh->nbuckets) @@ -173,7 +173,7 @@ unsigned int BLI_ghashutil_inthash(void *ptr) { key += ~(key << 9); key ^= (key >> 17); - return (unsigned int)(key & 0xffffffff); + return (unsigned int)(key & 0xffffffff); } int BLI_ghashutil_intcmp(void *a, void *b) { diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index bba9b1793c7..4d64f4a50ff 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -1490,7 +1490,7 @@ static float fast_ray_nearest_hit(const BVHRayCastData *data, const BVHNode *nod dist = t1x; if (t1y > dist) dist = t1y; - if (t1z > dist) dist = t1z; + if (t1z > dist) dist = t1z; return dist; } @@ -1613,7 +1613,7 @@ int BLI_bvhtree_ray_cast(BVHTree *tree, const float *co, const float *dir, float { dfs_raycast(&data, root); // iterative_raycast(&data, root); - } + } if(hit) diff --git a/source/blender/blenlib/intern/BLI_linklist.c b/source/blender/blenlib/intern/BLI_linklist.c index f9c5fc58a63..62d6f6b936c 100644 --- a/source/blender/blenlib/intern/BLI_linklist.c +++ b/source/blender/blenlib/intern/BLI_linklist.c @@ -92,13 +92,13 @@ void BLI_linklist_append(LinkNode **listp, void *ptr) { nlink->next = NULL; if(node == NULL){ - *listp = nlink; - } else { - while(node->next != NULL){ - node = node->next; - } - node->next = nlink; - } + *listp = nlink; + } else { + while(node->next != NULL){ + node = node->next; + } + node->next = nlink; + } } void BLI_linklist_prepend_arena(LinkNode **listp, void *ptr, MemArena *ma) { diff --git a/source/blender/blenlib/intern/boxpack2d.c b/source/blender/blenlib/intern/boxpack2d.c index eebffd6bd6e..1c910dbb519 100644 --- a/source/blender/blenlib/intern/boxpack2d.c +++ b/source/blender/blenlib/intern/boxpack2d.c @@ -240,17 +240,17 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height) if (vert->free & quad_flags[j]) { switch (j) { case BL: - SET_BOXRIGHT(box, vert->x); - SET_BOXTOP(box, vert->y); - break; + SET_BOXRIGHT(box, vert->x); + SET_BOXTOP(box, vert->y); + break; case TR: - SET_BOXLEFT(box, vert->x); - SET_BOXBOTTOM(box, vert->y); - break; + SET_BOXLEFT(box, vert->x); + SET_BOXBOTTOM(box, vert->y); + break; case TL: - SET_BOXRIGHT(box, vert->x); - SET_BOXBOTTOM(box, vert->y); - break; + SET_BOXRIGHT(box, vert->x); + SET_BOXBOTTOM(box, vert->y); + break; case BR: SET_BOXLEFT(box, vert->x); SET_BOXTOP(box, vert->y); @@ -302,11 +302,11 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height) case TR: box->v[BL]= vert; vert->trb = box; - break; + break; case TL: box->v[BR]= vert; vert->tlb = box; - break; + break; case BR: box->v[TL]= vert; vert->brb = box; @@ -314,7 +314,7 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height) case BL: box->v[TR]= vert; vert->blb = box; - break; + break; } /* Mask free flags for verts that are diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index f7c16a0a8b2..2367af470fe 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -77,7 +77,7 @@ enum BPathTypes { BPATH_SEQ, BPATH_CDATA, - BPATH_DONE + BPATH_DONE }; void BLI_bpathIterator_init( struct BPathIterator *bpi, char *base_path ) { diff --git a/source/blender/blenlib/intern/dynamiclist.c b/source/blender/blenlib/intern/dynamiclist.c index 48ba8247ea9..f059ce3736a 100644 --- a/source/blender/blenlib/intern/dynamiclist.c +++ b/source/blender/blenlib/intern/dynamiclist.c @@ -179,7 +179,7 @@ void *BLI_dlist_find_link(DynamicList *dlist, unsigned int index) if(!dlist || !dlist->da.items) return NULL; if((index <= dlist->da.last_item_index) && (index >= 0) && (dlist->da.count>0)){ - return dlist->da.items[index]; + return dlist->da.items[index]; } else { return NULL; diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c index a5c0e3f5b79..4f93abf8357 100644 --- a/source/blender/blenlib/intern/edgehash.c +++ b/source/blender/blenlib/intern/edgehash.c @@ -82,7 +82,7 @@ void BLI_edgehash_insert(EdgeHash *eh, int v0, int v1, void *val) { v1 ^= v0; v0 ^= v1; } - hash = EDGEHASH(v0,v1)%eh->nbuckets; + hash = EDGEHASH(v0,v1)%eh->nbuckets; e->v0 = v0; e->v1 = v1; @@ -215,7 +215,7 @@ void BLI_edgehashIterator_setValue(EdgeHashIterator *ehi, void *val) { void BLI_edgehashIterator_step(EdgeHashIterator *ehi) { if (ehi->curEntry) { - ehi->curEntry= ehi->curEntry->next; + ehi->curEntry= ehi->curEntry->next; while (!ehi->curEntry) { ehi->curBucket++; if (ehi->curBucket==ehi->eh->nbuckets) diff --git a/source/blender/blenlib/intern/fnmatch.c b/source/blender/blenlib/intern/fnmatch.c index ccb6fa72ea8..a78f9ad7585 100644 --- a/source/blender/blenlib/intern/fnmatch.c +++ b/source/blender/blenlib/intern/fnmatch.c @@ -66,97 +66,97 @@ fnmatch (const char *pattern, const char *string, int flags) # define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c)) while ((c = *p++) != '\0') - { - c = FOLD (c); + { + c = FOLD (c); - switch (c) + switch (c) { case '?': if (*n == '\0') - return FNM_NOMATCH; + return FNM_NOMATCH; else if ((flags & FNM_FILE_NAME) && *n == '/') - return FNM_NOMATCH; + return FNM_NOMATCH; else if ((flags & FNM_PERIOD) && *n == '.' && (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) - return FNM_NOMATCH; + return FNM_NOMATCH; break; case '\\': if (!(flags & FNM_NOESCAPE)) - { - c = *p++; - if (c == '\0') + { + c = *p++; + if (c == '\0') /* Trailing \ loses. */ return FNM_NOMATCH; - c = FOLD (c); - } + c = FOLD (c); + } if (FOLD (*n) != c) - return FNM_NOMATCH; + return FNM_NOMATCH; break; case '*': if ((flags & FNM_PERIOD) && *n == '.' && - (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) - return FNM_NOMATCH; + (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) + return FNM_NOMATCH; for (c = *p++; c == '?' || c == '*'; c = *p++) - { - if ((flags & FNM_FILE_NAME) && *n == '/') + { + if ((flags & FNM_FILE_NAME) && *n == '/') /* A slash does not match a wildcard under FNM_FILE_NAME. */ return FNM_NOMATCH; - else if (c == '?') + else if (c == '?') { /* A ? needs to match one character. */ if (*n == '\0') - /* There isn't another character; no match. */ - return FNM_NOMATCH; + /* There isn't another character; no match. */ + return FNM_NOMATCH; else - /* One character of the string is consumed in matching - this ? wildcard, so *??? won't match if there are - less than three characters. */ - ++n; + /* One character of the string is consumed in matching + this ? wildcard, so *??? won't match if there are + less than three characters. */ + ++n; + } } - } if (c == '\0') - return 0; + return 0; { - char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c; - c1 = FOLD (c1); - for (--p; *n != '\0'; ++n) - if ((c == '[' || FOLD (*n) == c1) && + char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c; + c1 = FOLD (c1); + for (--p; *n != '\0'; ++n) + if ((c == '[' || FOLD (*n) == c1) && fnmatch (p, n, flags & ~FNM_PERIOD) == 0) return 0; - return FNM_NOMATCH; + return FNM_NOMATCH; } case '[': { - /* Nonzero if the sense of the character class is inverted. */ - register int not; + /* Nonzero if the sense of the character class is inverted. */ + register int not; - if (*n == '\0') - return FNM_NOMATCH; + if (*n == '\0') + return FNM_NOMATCH; - if ((flags & FNM_PERIOD) && *n == '.' && + if ((flags & FNM_PERIOD) && *n == '.' && (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) - return FNM_NOMATCH; + return FNM_NOMATCH; - not = (*p == '!' || *p == '^'); - if (not) - ++p; + not = (*p == '!' || *p == '^'); + if (not) + ++p; - c = *p++; - for (;;) - { + c = *p++; + for (;;) + { register char cstart = c, cend = c; if (!(flags & FNM_NOESCAPE) && c == '\\') { - if (*p == '\0') - return FNM_NOMATCH; - cstart = cend = *p++; + if (*p == '\0') + return FNM_NOMATCH; + cstart = cend = *p++; } cstart = cend = FOLD (cstart); @@ -174,14 +174,14 @@ fnmatch (const char *pattern, const char *string, int flags) if (c == '-' && *p != ']') { - cend = *p++; - if (!(flags & FNM_NOESCAPE) && cend == '\\') - cend = *p++; - if (cend == '\0') - return FNM_NOMATCH; - cend = FOLD (cend); - - c = *p++; + cend = *p++; + if (!(flags & FNM_NOESCAPE) && cend == '\\') + cend = *p++; + if (cend == '\0') + return FNM_NOMATCH; + cend = FOLD (cend); + + c = *p++; } if (FOLD (*n) >= cstart && FOLD (*n) <= cend) @@ -189,15 +189,15 @@ fnmatch (const char *pattern, const char *string, int flags) if (c == ']') break; - } - if (!not) - return FNM_NOMATCH; - break; + } + if (!not) + return FNM_NOMATCH; + break; matched:; - /* Skip the rest of the [...] that already matched. */ - while (c != ']') - { + /* Skip the rest of the [...] that already matched. */ + while (c != ']') + { if (c == '\0') /* [... (unterminated) loses. */ return FNM_NOMATCH; @@ -205,31 +205,31 @@ fnmatch (const char *pattern, const char *string, int flags) c = *p++; if (!(flags & FNM_NOESCAPE) && c == '\\') { - if (*p == '\0') - return FNM_NOMATCH; - /* XXX 1003.2d11 is unclear if this is right. */ - ++p; + if (*p == '\0') + return FNM_NOMATCH; + /* XXX 1003.2d11 is unclear if this is right. */ + ++p; + } } - } - if (not) - return FNM_NOMATCH; + if (not) + return FNM_NOMATCH; } break; default: if (c != FOLD (*n)) - return FNM_NOMATCH; + return FNM_NOMATCH; } - ++n; - } + ++n; + } if (*n == '\0') - return 0; + return 0; if ((flags & FNM_LEADING_DIR) && *n == '/') - /* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz". */ - return 0; + /* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz". */ + return 0; return FNM_NOMATCH; diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index 9227803b681..6d6abc88999 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -429,7 +429,7 @@ static int check_freetypefont(PackedFile * pf) &face ); if(err) { success = 0; - //XXX error("This is not a valid font"); + //XXX error("This is not a valid font"); } else { /* @@ -522,14 +522,14 @@ int BLI_vfontchar_from_freetypefont(VFont *vfont, unsigned long character) typedef struct FT_Outline_ { - short n_contours; /* number of contours in glyph */ - short n_points; /* number of points in the glyph */ + short n_contours; /* number of contours in glyph */ + short n_points; /* number of points in the glyph */ - FT_Vector* points; /* the outline's points */ - char* tags; /* the points flags */ - short* contours; /* the contour end points */ + FT_Vector* points; /* the outline's points */ + char* tags; /* the points flags */ + short* contours; /* the contour end points */ - int flags; /* outline masks */ + int flags; /* outline masks */ } FT_Outline; @@ -569,44 +569,44 @@ The following rules are applied to decompose the contour's points into segments Note that it is possible to mix conic and cubic arcs in a single contour, even though no current font driver produces such outlines. - * # on - * off - __---__ + * # on + * off + __---__ #-__ _-- -_ - --__ _- - - --__ # \ - --__ # - -# - Two "on" points + --__ _- - + --__ # \ + --__ # + -# + Two "on" points Two "on" points and one "conic" point - between them + between them - * + * # __ Two "on" points with two "conic" \ - - points between them. The point - \ / \ marked '0' is the middle of the - - 0 \ "off" points, and is a 'virtual' - -_ _- # "on" point where the curve passes. - -- It does not appear in the point - list. - * + \ / \ marked '0' is the middle of the + - 0 \ "off" points, and is a 'virtual' + -_ _- # "on" point where the curve passes. + -- It does not appear in the point + list. + * - * # on - * * off - __---__ - _-- -_ - _- - + * # on + * * off + __---__ + _-- -_ + _- - # \ - # + # - Two "on" points + Two "on" points and two "cubic" point - between them + between them Each glyph's original outline points are located on a grid of indivisible units. The points are stored diff --git a/source/blender/blenlib/intern/math_base.c b/source/blender/blenlib/intern/math_base.c index 8301f790614..686b35a878e 100644 --- a/source/blender/blenlib/intern/math_base.c +++ b/source/blender/blenlib/intern/math_base.c @@ -45,12 +45,12 @@ double copysign(double x, double y) /* from python 3.1 pymath.c */ double round(double x) { - double absx, y; - absx = fabs(x); - y = floor(absx); - if (absx - y >= 0.5) - y += 1.0; - return copysign(y, x); + double absx, y; + absx = fabs(x); + y = floor(absx); + if (absx - y >= 0.5) + y += 1.0; + return copysign(y, x); } #endif diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index 633585a3336..a1bb2754d95 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -365,21 +365,21 @@ int constrain_rgb(float *r, float *g, float *b) { float w; - /* Amount of white needed is w = - min(0, *r, *g, *b) */ + /* Amount of white needed is w = - min(0, *r, *g, *b) */ - w = (0 < *r) ? 0 : *r; - w = (w < *g) ? w : *g; - w = (w < *b) ? w : *b; - w = -w; + w = (0 < *r) ? 0 : *r; + w = (w < *g) ? w : *g; + w = (w < *b) ? w : *b; + w = -w; - /* Add just enough white to make r, g, b all positive. */ + /* Add just enough white to make r, g, b all positive. */ - if (w > 0) { - *r += w; *g += w; *b += w; - return 1; /* Color modified to fit RGB gamut */ - } + if (w > 0) { + *r += w; *g += w; *b += w; + return 1; /* Color modified to fit RGB gamut */ + } - return 0; /* Color within RGB gamut */ + return 0; /* Color within RGB gamut */ } float rgb_to_grayscale(float rgb[3]) diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index f2454f05977..27f36752f80 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -957,7 +957,7 @@ int isect_line_line_strict_v3(float v1[3], float v2[3], float v3[3], float v4[3] int isect_aabb_aabb_v3(float min1[3], float max1[3], float min2[3], float max2[3]) { return (min1[0]<max2[0] && min1[1]<max2[1] && min1[2]<max2[2] && - min2[0]<max1[0] && min2[1]<max1[1] && min2[2]<max1[2]); + min2[0]<max1[0] && min2[1]<max1[1] && min2[2]<max1[2]); } /* find closest point to p on line through l1,l2 and return lambda, @@ -1396,14 +1396,14 @@ void barycentric_weights_v2(const float v1[2], const float v2[2], const float v3 wtot = w[0]+w[1]+w[2]; if (wtot != 0.0f) { - wtot_inv = 1.0f/wtot; + wtot_inv = 1.0f/wtot; - w[0] = w[0]*wtot_inv; - w[1] = w[1]*wtot_inv; - w[2] = w[2]*wtot_inv; + w[0] = w[0]*wtot_inv; + w[1] = w[1]*wtot_inv; + w[2] = w[2]*wtot_inv; } else /* dummy values for zero area face */ - w[0] = w[1] = w[2] = 1.0f/3.0f; + w[0] = w[1] = w[2] = 1.0f/3.0f; } /* given 2 triangles in 3D space, and a point in relation to the first triangle. @@ -1608,21 +1608,21 @@ void interp_cubic_v3(float *x, float *v,float *x1, float *v1, float *x2, float * void orthographic_m4(float matrix[][4],float left, float right, float bottom, float top, float nearClip, float farClip) { - float Xdelta, Ydelta, Zdelta; + float Xdelta, Ydelta, Zdelta; - Xdelta = right - left; - Ydelta = top - bottom; - Zdelta = farClip - nearClip; - if (Xdelta == 0.0 || Ydelta == 0.0 || Zdelta == 0.0) { + Xdelta = right - left; + Ydelta = top - bottom; + Zdelta = farClip - nearClip; + if (Xdelta == 0.0 || Ydelta == 0.0 || Zdelta == 0.0) { return; - } - unit_m4(matrix); - matrix[0][0] = 2.0f/Xdelta; - matrix[3][0] = -(right + left)/Xdelta; - matrix[1][1] = 2.0f/Ydelta; - matrix[3][1] = -(top + bottom)/Ydelta; - matrix[2][2] = -2.0f/Zdelta; /* note: negate Z */ - matrix[3][2] = -(farClip + nearClip)/Zdelta; + } + unit_m4(matrix); + matrix[0][0] = 2.0f/Xdelta; + matrix[3][0] = -(right + left)/Xdelta; + matrix[1][1] = 2.0f/Ydelta; + matrix[3][1] = -(top + bottom)/Ydelta; + matrix[2][2] = -2.0f/Zdelta; /* note: negate Z */ + matrix[3][2] = -(farClip + nearClip)/Zdelta; } void perspective_m4(float mat[][4],float left, float right, float bottom, float top, float nearClip, float farClip) @@ -1644,22 +1644,22 @@ void perspective_m4(float mat[][4],float left, float right, float bottom, float mat[2][3] = -1.0f; mat[3][2] = (-2.0f * nearClip * farClip)/Zdelta; mat[0][1] = mat[0][2] = mat[0][3] = - mat[1][0] = mat[1][2] = mat[1][3] = - mat[3][0] = mat[3][1] = mat[3][3] = 0.0; + mat[1][0] = mat[1][2] = mat[1][3] = + mat[3][0] = mat[3][1] = mat[3][3] = 0.0; } static void i_multmatrix(float icand[][4], float Vm[][4]) { - int row, col; - float temp[4][4]; - - for(row=0 ; row<4 ; row++) - for(col=0 ; col<4 ; col++) - temp[row][col] = icand[row][0] * Vm[0][col] - + icand[row][1] * Vm[1][col] - + icand[row][2] * Vm[2][col] - + icand[row][3] * Vm[3][col]; + int row, col; + float temp[4][4]; + + for(row=0 ; row<4 ; row++) + for(col=0 ; col<4 ; col++) + temp[row][col] = icand[row][0] * Vm[0][col] + + icand[row][1] * Vm[1][col] + + icand[row][2] * Vm[2][col] + + icand[row][3] * Vm[3][col]; copy_m4_m4(Vm, temp); } @@ -1669,10 +1669,10 @@ void polarview_m4(float Vm[][4],float dist, float azimuth, float incidence, floa unit_m4(Vm); - translate_m4(Vm,0.0, 0.0, -dist); - rotate_m4(Vm,'z',-twist); - rotate_m4(Vm,'x',-incidence); - rotate_m4(Vm,'z',-azimuth); + translate_m4(Vm,0.0, 0.0, -dist); + rotate_m4(Vm,'z',-twist); + rotate_m4(Vm,'x',-incidence); + rotate_m4(Vm,'z',-azimuth); } void lookat_m4(float mat[][4],float vx, float vy, float vz, float px, float py, float pz, float twist) @@ -1706,8 +1706,8 @@ void lookat_m4(float mat[][4],float vx, float vy, float vz, float px, float py, i_multmatrix(mat1, mat); - mat1[1][1] = mat1[2][2] = 1.0f; /* be careful here to reinit */ - mat1[1][2] = mat1[2][1] = 0.0; /* those modified by the last */ + mat1[1][1] = mat1[2][2] = 1.0f; /* be careful here to reinit */ + mat1[1][2] = mat1[2][1] = 0.0; /* those modified by the last */ /* paragraph */ if (hyp != 0.0f) { /* rotate Y */ @@ -1879,7 +1879,7 @@ void tangent_from_uv(float *uv1, float *uv2, float *uv3, float *co1, float *co2, /* vector clouds */ /* void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight,float (*rpos)[3], float *rweight, - float lloc[3],float rloc[3],float lrot[3][3],float lscale[3][3]) + float lloc[3],float rloc[3],float lrot[3][3],float lscale[3][3]) input ( @@ -1903,13 +1903,13 @@ pointers may be NULL if not needed /* can't believe there is none in math utils */ float _det_m3(float m2[3][3]) { - float det = 0.f; - if (m2){ - det= m2[0][0]* (m2[1][1]*m2[2][2] - m2[1][2]*m2[2][1]) - -m2[1][0]* (m2[0][1]*m2[2][2] - m2[0][2]*m2[2][1]) - +m2[2][0]* (m2[0][1]*m2[1][2] - m2[0][2]*m2[1][1]); - } - return det; + float det = 0.f; + if (m2){ + det= m2[0][0]* (m2[1][1]*m2[2][2] - m2[1][2]*m2[2][1]) + -m2[1][0]* (m2[0][1]*m2[2][2] - m2[0][2]*m2[2][1]) + +m2[2][0]* (m2[0][1]*m2[1][2] - m2[0][2]*m2[1][1]); + } + return det; } diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index dcf927f7c43..fca8cf445d1 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -154,17 +154,17 @@ void mul_m4_m4m4(float m1[][4], float m2[][4], float m3[][4]) void mul_m3_m3m3(float m1[][3], float m3[][3], float m2[][3]) { /* m1[i][j] = m2[i][k]*m3[k][j], args are flipped! */ - m1[0][0]= m2[0][0]*m3[0][0] + m2[0][1]*m3[1][0] + m2[0][2]*m3[2][0]; - m1[0][1]= m2[0][0]*m3[0][1] + m2[0][1]*m3[1][1] + m2[0][2]*m3[2][1]; - m1[0][2]= m2[0][0]*m3[0][2] + m2[0][1]*m3[1][2] + m2[0][2]*m3[2][2]; + m1[0][0]= m2[0][0]*m3[0][0] + m2[0][1]*m3[1][0] + m2[0][2]*m3[2][0]; + m1[0][1]= m2[0][0]*m3[0][1] + m2[0][1]*m3[1][1] + m2[0][2]*m3[2][1]; + m1[0][2]= m2[0][0]*m3[0][2] + m2[0][1]*m3[1][2] + m2[0][2]*m3[2][2]; - m1[1][0]= m2[1][0]*m3[0][0] + m2[1][1]*m3[1][0] + m2[1][2]*m3[2][0]; - m1[1][1]= m2[1][0]*m3[0][1] + m2[1][1]*m3[1][1] + m2[1][2]*m3[2][1]; - m1[1][2]= m2[1][0]*m3[0][2] + m2[1][1]*m3[1][2] + m2[1][2]*m3[2][2]; + m1[1][0]= m2[1][0]*m3[0][0] + m2[1][1]*m3[1][0] + m2[1][2]*m3[2][0]; + m1[1][1]= m2[1][0]*m3[0][1] + m2[1][1]*m3[1][1] + m2[1][2]*m3[2][1]; + m1[1][2]= m2[1][0]*m3[0][2] + m2[1][1]*m3[1][2] + m2[1][2]*m3[2][2]; - m1[2][0]= m2[2][0]*m3[0][0] + m2[2][1]*m3[1][0] + m2[2][2]*m3[2][0]; - m1[2][1]= m2[2][0]*m3[0][1] + m2[2][1]*m3[1][1] + m2[2][2]*m3[2][1]; - m1[2][2]= m2[2][0]*m3[0][2] + m2[2][1]*m3[1][2] + m2[2][2]*m3[2][2]; + m1[2][0]= m2[2][0]*m3[0][0] + m2[2][1]*m3[1][0] + m2[2][2]*m3[2][0]; + m1[2][1]= m2[2][0]*m3[0][1] + m2[2][1]*m3[1][1] + m2[2][2]*m3[2][1]; + m1[2][2]= m2[2][0]*m3[0][2] + m2[2][1]*m3[1][2] + m2[2][2]*m3[2][2]; } void mul_m4_m4m3(float (*m1)[4], float (*m3)[4], float (*m2)[3]) @@ -183,18 +183,18 @@ void mul_m4_m4m3(float (*m1)[4], float (*m3)[4], float (*m2)[3]) /* m1 = m2 * m3, ignore the elements on the 4th row/column of m3*/ void mul_m3_m3m4(float m1[][3], float m2[][3], float m3[][4]) { - /* m1[i][j] = m2[i][k] * m3[k][j] */ - m1[0][0] = m2[0][0] * m3[0][0] + m2[0][1] * m3[1][0] +m2[0][2] * m3[2][0]; - m1[0][1] = m2[0][0] * m3[0][1] + m2[0][1] * m3[1][1] +m2[0][2] * m3[2][1]; - m1[0][2] = m2[0][0] * m3[0][2] + m2[0][1] * m3[1][2] +m2[0][2] * m3[2][2]; + /* m1[i][j] = m2[i][k] * m3[k][j] */ + m1[0][0] = m2[0][0] * m3[0][0] + m2[0][1] * m3[1][0] +m2[0][2] * m3[2][0]; + m1[0][1] = m2[0][0] * m3[0][1] + m2[0][1] * m3[1][1] +m2[0][2] * m3[2][1]; + m1[0][2] = m2[0][0] * m3[0][2] + m2[0][1] * m3[1][2] +m2[0][2] * m3[2][2]; - m1[1][0] = m2[1][0] * m3[0][0] + m2[1][1] * m3[1][0] +m2[1][2] * m3[2][0]; - m1[1][1] = m2[1][0] * m3[0][1] + m2[1][1] * m3[1][1] +m2[1][2] * m3[2][1]; - m1[1][2] = m2[1][0] * m3[0][2] + m2[1][1] * m3[1][2] +m2[1][2] * m3[2][2]; + m1[1][0] = m2[1][0] * m3[0][0] + m2[1][1] * m3[1][0] +m2[1][2] * m3[2][0]; + m1[1][1] = m2[1][0] * m3[0][1] + m2[1][1] * m3[1][1] +m2[1][2] * m3[2][1]; + m1[1][2] = m2[1][0] * m3[0][2] + m2[1][1] * m3[1][2] +m2[1][2] * m3[2][2]; - m1[2][0] = m2[2][0] * m3[0][0] + m2[2][1] * m3[1][0] +m2[2][2] * m3[2][0]; - m1[2][1] = m2[2][0] * m3[0][1] + m2[2][1] * m3[1][1] +m2[2][2] * m3[2][1]; - m1[2][2] = m2[2][0] * m3[0][2] + m2[2][1] * m3[1][2] +m2[2][2] * m3[2][2]; + m1[2][0] = m2[2][0] * m3[0][0] + m2[2][1] * m3[1][0] +m2[2][2] * m3[2][0]; + m1[2][1] = m2[2][0] * m3[0][1] + m2[2][1] * m3[1][1] +m2[2][2] * m3[2][1]; + m1[2][2] = m2[2][0] * m3[0][2] + m2[2][1] * m3[1][2] +m2[2][2] * m3[2][2]; } void mul_m4_m3m4(float (*m1)[4], float (*m3)[3], float (*m2)[4]) @@ -437,8 +437,8 @@ int invert_m3_m3(float m1[3][3], float m2[3][3]) /* then determinant old matrix! */ det= m2[0][0]* (m2[1][1]*m2[2][2] - m2[1][2]*m2[2][1]) - -m2[1][0]* (m2[0][1]*m2[2][2] - m2[0][2]*m2[2][1]) - +m2[2][0]* (m2[0][1]*m2[1][2] - m2[0][2]*m2[1][1]); + -m2[1][0]* (m2[0][1]*m2[2][2] - m2[0][2]*m2[2][1]) + +m2[2][0]* (m2[0][1]*m2[1][2] - m2[0][2]*m2[1][1]); success= (det != 0); @@ -823,8 +823,8 @@ float determinant_m3(float a1, float a2, float a3, float ans; ans = a1 * determinant_m2(b2, b3, c2, c3) - - b1 * determinant_m2(a2, a3, c2, c3) - + c1 * determinant_m2(a2, a3, b2, b3); + - b1 * determinant_m2(a2, a3, c2, c3) + + c1 * determinant_m2(a2, a3, b2, b3); return ans; } @@ -855,9 +855,9 @@ float determinant_m4(float m[][4]) d4= m[3][3]; ans = a1 * determinant_m3(b2, b3, b4, c2, c3, c4, d2, d3, d4) - - b1 * determinant_m3(a2, a3, a4, c2, c3, c4, d2, d3, d4) - + c1 * determinant_m3(a2, a3, a4, b2, b3, b4, d2, d3, d4) - - d1 * determinant_m3(a2, a3, a4, b2, b3, b4, c2, c3, c4); + - b1 * determinant_m3(a2, a3, a4, c2, c3, c4, d2, d3, d4) + + c1 * determinant_m3(a2, a3, a4, b2, b3, b4, d2, d3, d4) + - d1 * determinant_m3(a2, a3, a4, b2, b3, b4, c2, c3, c4); return ans; } @@ -938,47 +938,47 @@ void scale_m4_fl(float m[][4], float scale) void translate_m4(float mat[][4],float Tx, float Ty, float Tz) { - mat[3][0] += (Tx*mat[0][0] + Ty*mat[1][0] + Tz*mat[2][0]); - mat[3][1] += (Tx*mat[0][1] + Ty*mat[1][1] + Tz*mat[2][1]); - mat[3][2] += (Tx*mat[0][2] + Ty*mat[1][2] + Tz*mat[2][2]); + mat[3][0] += (Tx*mat[0][0] + Ty*mat[1][0] + Tz*mat[2][0]); + mat[3][1] += (Tx*mat[0][1] + Ty*mat[1][1] + Tz*mat[2][1]); + mat[3][2] += (Tx*mat[0][2] + Ty*mat[1][2] + Tz*mat[2][2]); } void rotate_m4(float mat[][4], const char axis, const float angle) { int col; - float temp[4]= {0.0f, 0.0f, 0.0f, 0.0f}; - float cosine, sine; - - cosine = (float)cos(angle); - sine = (float)sin(angle); - switch(axis){ - case 'X': - for(col=0 ; col<4 ; col++) - temp[col] = cosine*mat[1][col] + sine*mat[2][col]; - for(col=0 ; col<4 ; col++) { - mat[2][col] = - sine*mat[1][col] + cosine*mat[2][col]; - mat[1][col] = temp[col]; + float temp[4]= {0.0f, 0.0f, 0.0f, 0.0f}; + float cosine, sine; + + cosine = (float)cos(angle); + sine = (float)sin(angle); + switch(axis){ + case 'X': + for(col=0 ; col<4 ; col++) + temp[col] = cosine*mat[1][col] + sine*mat[2][col]; + for(col=0 ; col<4 ; col++) { + mat[2][col] = - sine*mat[1][col] + cosine*mat[2][col]; + mat[1][col] = temp[col]; } - break; - - case 'Y': - for(col=0 ; col<4 ; col++) - temp[col] = cosine*mat[0][col] - sine*mat[2][col]; - for(col=0 ; col<4 ; col++) { - mat[2][col] = sine*mat[0][col] + cosine*mat[2][col]; - mat[0][col] = temp[col]; - } + break; + + case 'Y': + for(col=0 ; col<4 ; col++) + temp[col] = cosine*mat[0][col] - sine*mat[2][col]; + for(col=0 ; col<4 ; col++) { + mat[2][col] = sine*mat[0][col] + cosine*mat[2][col]; + mat[0][col] = temp[col]; + } break; - case 'Z': - for(col=0 ; col<4 ; col++) - temp[col] = cosine*mat[0][col] + sine*mat[1][col]; - for(col=0 ; col<4 ; col++) { - mat[1][col] = - sine*mat[0][col] + cosine*mat[1][col]; - mat[0][col] = temp[col]; - } + case 'Z': + for(col=0 ; col<4 ; col++) + temp[col] = cosine*mat[0][col] + sine*mat[1][col]; + for(col=0 ; col<4 ; col++) { + mat[1][col] = - sine*mat[0][col] + cosine*mat[1][col]; + mat[0][col] = temp[col]; + } break; - } + } } void blend_m3_m3m3(float out[][3], float dst[][3], float src[][3], float srcweight) diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index b6dc0ca06cd..4af0a3a4248 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -900,12 +900,12 @@ void quat_to_eul(float *eul,float *quat) /* XYZ order */ void eul_to_quat(float *quat,float *eul) { - float ti, tj, th, ci, cj, ch, si, sj, sh, cc, cs, sc, ss; + float ti, tj, th, ci, cj, ch, si, sj, sh, cc, cs, sc, ss; - ti = eul[0]*0.5f; tj = eul[1]*0.5f; th = eul[2]*0.5f; - ci = (float)cos(ti); cj = (float)cos(tj); ch = (float)cos(th); - si = (float)sin(ti); sj = (float)sin(tj); sh = (float)sin(th); - cc = ci*ch; cs = ci*sh; sc = si*ch; ss = si*sh; + ti = eul[0]*0.5f; tj = eul[1]*0.5f; th = eul[2]*0.5f; + ci = (float)cos(ti); cj = (float)cos(tj); ch = (float)cos(th); + si = (float)sin(ti); sj = (float)sin(tj); sh = (float)sin(th); + cc = ci*ch; cs = ci*sh; sc = si*ch; ss = si*sh; quat[0] = cj*cc + sj*ss; quat[1] = cj*sc - sj*cs; @@ -1025,7 +1025,7 @@ void mat3_to_compatible_eul(float *eul, float *oldrot,float mat[][3]) /* Euler Rotation Order Code: * was adapted from - ANSI C code from the article + ANSI C code from the article "Euler Angle Conversion" by Ken Shoemake, shoemake@graphics.cis.upenn.edu in "Graphics Gems IV", Academic Press, 1994 @@ -1299,11 +1299,11 @@ void eulO_to_gimbal_axis(float gmat[][3], float *eul, short order) freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. + misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Author: Ladislav Kavan, kavanl@cs.tcd.ie diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 9bb960340ac..1a50234ef1e 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -391,7 +391,7 @@ MINLINE int compare_v3v3(float *v1, float *v2, float limit) MINLINE int compare_len_v3v3(float *v1, float *v2, float limit) { - float x,y,z; + float x,y,z; x=v1[0]-v2[0]; y=v1[1]-v2[1]; diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index d0ce193e0e0..44429eca3b1 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -907,11 +907,11 @@ float g[512+2][3]= { #define DOT(a,b) (a[0] * b[0] + a[1] * b[1] + a[2] * b[2]) #define setup(i,b0,b1,r0,r1) \ - t = vec[i] + 10000.; \ - b0 = ((int)t) & 255; \ - b1 = (b0+1) & 255; \ - r0 = t - (int)t; \ - r1 = r0 - 1.; + t = vec[i] + 10000.; \ + b0 = ((int)t) & 255; \ + b1 = (b0+1) & 255; \ + r0 = t - (int)t; \ + r1 = r0 - 1.; static float noise3_perlin(float vec[3]) @@ -1490,7 +1490,7 @@ float mg_fBm(float x, float y, float z, float H, float lacunarity, float octaves * ``offset'' is the zero offset, which determines multifractality (NOT USED??) */ /* this one is in fact rather confusing, - * there seem to be errors in the original source code (in all three versions of proc.text&mod), + * there seem to be errors in the original source code (in all three versions of proc.text&mod), * I modified it to something that made sense to me, so it might be wrong... */ float mg_MultiFractal(float x, float y, float z, float H, float lacunarity, float octaves, int noisebasis) { diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 00cb6764b60..f630ba30a68 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1197,7 +1197,7 @@ void BLI_join_dirfile(char *string, const char *dir, const char *file) Logic: - if an image is "below" current .blend file directory, rebuild the - same dir structure in dest_dir + same dir structure in dest_dir For example //textures/foo/bar.png becomes [dest_dir]/textures/foo/bar.png. diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index c21f086156e..c0f758187a4 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -225,7 +225,7 @@ static void update_node_vb(PBVH *bvh, PBVHNode *node) /* Adapted from BLI_kdopbvh.c */ /* Returns the index of the first element on the right of the partition */ static int partition_indices(int *prim_indices, int lo, int hi, int axis, - float mid, BBC *prim_bbc) + float mid, BBC *prim_bbc) { int i=lo, j=hi; for(;;) { @@ -241,7 +241,7 @@ static int partition_indices(int *prim_indices, int lo, int hi, int axis, } void check_partitioning(int *prim_indices, int lo, int hi, int axis, - float mid, BBC *prim_bbc, int index_of_2nd_partition) + float mid, BBC *prim_bbc, int index_of_2nd_partition) { int i; for(i = lo; i <= hi; ++i) { @@ -273,8 +273,8 @@ static void grow_nodes(PBVH *bvh, int totnode) /* Add a vertex to the map, with a positive value for unique vertices and a negative value for additional vertices */ static int map_insert_vert(PBVH *bvh, GHash *map, - unsigned int *face_verts, - unsigned int *uniq_verts, int vertex) + unsigned int *face_verts, + unsigned int *uniq_verts, int vertex) { void *value, *key = SET_INT_IN_POINTER(vertex); @@ -328,8 +328,8 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node) /* Build the vertex list, unique verts first */ for(iter = BLI_ghashIterator_new(map), i = 0; - !BLI_ghashIterator_isDone(iter); - BLI_ghashIterator_step(iter), ++i) { + !BLI_ghashIterator_isDone(iter); + BLI_ghashIterator_step(iter), ++i) { void *value = BLI_ghashIterator_getValue(iter); int ndx = GET_INT_FROM_POINTER(value); @@ -375,7 +375,7 @@ static void build_grids_leaf_node(PBVH *bvh, PBVHNode *node) */ void build_sub(PBVH *bvh, int node_index, BB *cb, BBC *prim_bbc, - int offset, int count) + int offset, int count) { int i, axis, end; BB cb_backing; @@ -746,11 +746,11 @@ static void pbvh_update_normals(PBVH *bvh, PBVHNode **nodes, /* subtle assumptions: - We know that for all edited vertices, the nodes with faces - adjacent to these vertices have been marked with PBVH_UpdateNormals. + adjacent to these vertices have been marked with PBVH_UpdateNormals. This is true because if the vertex is inside the brush radius, the bounding box of it's adjacent faces will be as well. - However this is only true for the vertices that have actually been - edited, not for all vertices in the nodes marked for update, so we + edited, not for all vertices in the nodes marked for update, so we can only update vertices marked with ME_VERT_PBVH_UPDATE. */ @@ -998,8 +998,8 @@ void BLI_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *tot faces= MEM_callocN(sizeof(void*)*tot, "PBVH Grid Faces"); for(hiter = BLI_ghashIterator_new(map), i = 0; - !BLI_ghashIterator_isDone(hiter); - BLI_ghashIterator_step(hiter), ++i) + !BLI_ghashIterator_isDone(hiter); + BLI_ghashIterator_step(hiter), ++i) faces[i]= BLI_ghashIterator_getKey(hiter); BLI_ghashIterator_free(hiter); @@ -1124,7 +1124,7 @@ static int ray_aabb_intersect(PBVHNode *node, void *data_v) } void BLI_pbvh_raycast(PBVH *bvh, BLI_pbvh_HitCallback cb, void *data, - float ray_start[3], float ray_normal[3], int original) + float ray_start[3], float ray_normal[3], int original) { RaycastData rcd; diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 9870951d4d3..3329562f3a2 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -166,7 +166,7 @@ static void *new_mem_element(int size) if(cur) { if(size+offs < blocksize) { adr= (void *) (cur->data+offs); - offs+= size; + offs+= size; return adr; } } @@ -285,7 +285,7 @@ static short testedgeside(float *v1, float *v2, float *v3) float inp; inp= (v2[cox]-v1[cox])*(v1[coy]-v3[coy]) - +(v1[coy]-v2[coy])*(v1[cox]-v3[cox]); + +(v1[coy]-v2[coy])*(v1[cox]-v3[cox]); if(inp<0.0) return 0; else if(inp==0) { @@ -362,7 +362,7 @@ static ScFillVert *addedgetoscanlist(EditEdge *eed, int len) /* find location in list */ scsearch.v1= eed->v1; sc= (ScFillVert *)bsearch(&scsearch,scdata,len, - sizeof(ScFillVert), vergscdata); + sizeof(ScFillVert), vergscdata); if(sc==0) printf("Error in search edge: %p\n",eed); else if(addedgetoscanvert(sc,eed)==0) return sc; diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 086f20b7e21..a2f30ae5b01 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -334,7 +334,7 @@ void BLI_adddirstrings() strcpy(files[num].owner, pwuser->pw_name); } else { sprintf(files[num].owner, "%d", files[num].s.st_uid); - } + } } #endif diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index fd0b7e13a66..c344d8c0711 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -220,10 +220,10 @@ int BLI_strcaseeq(const char *a, const char *b) /* strcasestr not available in MSVC */ char *BLI_strcasestr(const char *s, const char *find) { - register char c, sc; - register size_t len; + register char c, sc; + register size_t len; - if ((c = *find++) != 0) { + if ((c = *find++) != 0) { c= tolower(c); len = strlen(find); do { @@ -234,8 +234,8 @@ char *BLI_strcasestr(const char *s, const char *find) } while (sc != c); } while (BLI_strncasecmp(s, find, len) != 0); s--; - } - return ((char *) s); + } + return ((char *) s); } diff --git a/source/blender/blenlib/intern/voxel.c b/source/blender/blenlib/intern/voxel.c index 302d721264d..31ed116c40a 100644 --- a/source/blender/blenlib/intern/voxel.c +++ b/source/blender/blenlib/intern/voxel.c @@ -93,9 +93,9 @@ float voxel_sample_trilinear(float *data, int *res, float *co) const float w[2] = {1.f - dz, dz}; return w[0] * ( v[0] * ( u[0] * data[xc[0] + yc[0] + zc[0]] + u[1] * data[xc[1] + yc[0] + zc[0]] ) - + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[0]] + u[1] * data[xc[1] + yc[1] + zc[0]] ) ) - + w[1] * ( v[0] * ( u[0] * data[xc[0] + yc[0] + zc[1]] + u[1] * data[xc[1] + yc[0] + zc[1]] ) - + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[1]] + u[1] * data[xc[1] + yc[1] + zc[1]] ) ); + + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[0]] + u[1] * data[xc[1] + yc[1] + zc[0]] ) ) + + w[1] * ( v[0] * ( u[0] * data[xc[0] + yc[0] + zc[1]] + u[1] * data[xc[1] + yc[0] + zc[1]] ) + + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[1]] + u[1] * data[xc[1] + yc[1] + zc[1]] ) ); } return 0.f; @@ -119,14 +119,14 @@ float voxel_sample_triquadratic(float *data, int *res, float *co) const float w[3] = {dz*(0.5f*dz - 1.f) + 0.5f, dz*(1.f - dz) + 0.5f, 0.5f*dz*dz}; return w[0] * ( v[0] * ( u[0] * data[xc[0] + yc[0] + zc[0]] + u[1] * data[xc[1] + yc[0] + zc[0]] + u[2] * data[xc[2] + yc[0] + zc[0]] ) - + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[0]] + u[1] * data[xc[1] + yc[1] + zc[0]] + u[2] * data[xc[2] + yc[1] + zc[0]] ) - + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[0]] + u[1] * data[xc[1] + yc[2] + zc[0]] + u[2] * data[xc[2] + yc[2] + zc[0]] ) ) - + w[1] * ( v[0] * ( u[0] * data[xc[0] + yc[0] + zc[1]] + u[1] * data[xc[1] + yc[0] + zc[1]] + u[2] * data[xc[2] + yc[0] + zc[1]] ) - + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[1]] + u[1] * data[xc[1] + yc[1] + zc[1]] + u[2] * data[xc[2] + yc[1] + zc[1]] ) - + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[1]] + u[1] * data[xc[1] + yc[2] + zc[1]] + u[2] * data[xc[2] + yc[2] + zc[1]] ) ) - + w[2] * ( v[0] * ( u[0] * data[xc[0] + yc[0] + zc[2]] + u[1] * data[xc[1] + yc[0] + zc[2]] + u[2] * data[xc[2] + yc[0] + zc[2]] ) - + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[2]] + u[1] * data[xc[1] + yc[1] + zc[2]] + u[2] * data[xc[2] + yc[1] + zc[2]] ) - + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[2]] + u[1] * data[xc[1] + yc[2] + zc[2]] + u[2] * data[xc[2] + yc[2] + zc[2]] ) ); + + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[0]] + u[1] * data[xc[1] + yc[1] + zc[0]] + u[2] * data[xc[2] + yc[1] + zc[0]] ) + + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[0]] + u[1] * data[xc[1] + yc[2] + zc[0]] + u[2] * data[xc[2] + yc[2] + zc[0]] ) ) + + w[1] * ( v[0] * ( u[0] * data[xc[0] + yc[0] + zc[1]] + u[1] * data[xc[1] + yc[0] + zc[1]] + u[2] * data[xc[2] + yc[0] + zc[1]] ) + + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[1]] + u[1] * data[xc[1] + yc[1] + zc[1]] + u[2] * data[xc[2] + yc[1] + zc[1]] ) + + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[1]] + u[1] * data[xc[1] + yc[2] + zc[1]] + u[2] * data[xc[2] + yc[2] + zc[1]] ) ) + + w[2] * ( v[0] * ( u[0] * data[xc[0] + yc[0] + zc[2]] + u[1] * data[xc[1] + yc[0] + zc[2]] + u[2] * data[xc[2] + yc[0] + zc[2]] ) + + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[2]] + u[1] * data[xc[1] + yc[1] + zc[2]] + u[2] * data[xc[2] + yc[1] + zc[2]] ) + + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[2]] + u[1] * data[xc[1] + yc[2] + zc[2]] + u[2] * data[xc[2] + yc[2] + zc[2]] ) ); } return 0.f; @@ -176,21 +176,21 @@ float voxel_sample_tricubic(float *data, int *res, float *co, int bspline) } return w[0] * ( v[0] * ( u[0] * data[xc[0] + yc[0] + zc[0]] + u[1] * data[xc[1] + yc[0] + zc[0]] + u[2] * data[xc[2] + yc[0] + zc[0]] + u[3] * data[xc[3] + yc[0] + zc[0]] ) - + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[0]] + u[1] * data[xc[1] + yc[1] + zc[0]] + u[2] * data[xc[2] + yc[1] + zc[0]] + u[3] * data[xc[3] + yc[1] + zc[0]] ) - + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[0]] + u[1] * data[xc[1] + yc[2] + zc[0]] + u[2] * data[xc[2] + yc[2] + zc[0]] + u[3] * data[xc[3] + yc[2] + zc[0]] ) - + v[3] * ( u[0] * data[xc[0] + yc[3] + zc[0]] + u[1] * data[xc[1] + yc[3] + zc[0]] + u[2] * data[xc[2] + yc[3] + zc[0]] + u[3] * data[xc[3] + yc[3] + zc[0]] ) ) - + w[1] * ( v[0] * ( u[0] * data[xc[0] + yc[0] + zc[1]] + u[1] * data[xc[1] + yc[0] + zc[1]] + u[2] * data[xc[2] + yc[0] + zc[1]] + u[3] * data[xc[3] + yc[0] + zc[1]] ) - + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[1]] + u[1] * data[xc[1] + yc[1] + zc[1]] + u[2] * data[xc[2] + yc[1] + zc[1]] + u[3] * data[xc[3] + yc[1] + zc[1]] ) - + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[1]] + u[1] * data[xc[1] + yc[2] + zc[1]] + u[2] * data[xc[2] + yc[2] + zc[1]] + u[3] * data[xc[3] + yc[2] + zc[1]] ) - + v[3] * ( u[0] * data[xc[0] + yc[3] + zc[1]] + u[1] * data[xc[1] + yc[3] + zc[1]] + u[2] * data[xc[2] + yc[3] + zc[1]] + u[3] * data[xc[3] + yc[3] + zc[1]] ) ) - + w[2] * ( v[0] * ( u[0] * data[xc[0] + yc[0] + zc[2]] + u[1] * data[xc[1] + yc[0] + zc[2]] + u[2] * data[xc[2] + yc[0] + zc[2]] + u[3] * data[xc[3] + yc[0] + zc[2]] ) - + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[2]] + u[1] * data[xc[1] + yc[1] + zc[2]] + u[2] * data[xc[2] + yc[1] + zc[2]] + u[3] * data[xc[3] + yc[1] + zc[2]] ) - + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[2]] + u[1] * data[xc[1] + yc[2] + zc[2]] + u[2] * data[xc[2] + yc[2] + zc[2]] + u[3] * data[xc[3] + yc[2] + zc[2]] ) - + v[3] * ( u[0] * data[xc[0] + yc[3] + zc[2]] + u[1] * data[xc[1] + yc[3] + zc[2]] + u[2] * data[xc[2] + yc[3] + zc[2]] + u[3] * data[xc[3] + yc[3] + zc[2]] ) ) - + w[3] * ( v[0] * ( u[0] * data[xc[0] + yc[0] + zc[3]] + u[1] * data[xc[1] + yc[0] + zc[3]] + u[2] * data[xc[2] + yc[0] + zc[3]] + u[3] * data[xc[3] + yc[0] + zc[3]] ) - + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[3]] + u[1] * data[xc[1] + yc[1] + zc[3]] + u[2] * data[xc[2] + yc[1] + zc[3]] + u[3] * data[xc[3] + yc[1] + zc[3]] ) - + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[3]] + u[1] * data[xc[1] + yc[2] + zc[3]] + u[2] * data[xc[2] + yc[2] + zc[3]] + u[3] * data[xc[3] + yc[2] + zc[3]] ) - + v[3] * ( u[0] * data[xc[0] + yc[3] + zc[3]] + u[1] * data[xc[1] + yc[3] + zc[3]] + u[2] * data[xc[2] + yc[3] + zc[3]] + u[3] * data[xc[3] + yc[3] + zc[3]] ) ); + + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[0]] + u[1] * data[xc[1] + yc[1] + zc[0]] + u[2] * data[xc[2] + yc[1] + zc[0]] + u[3] * data[xc[3] + yc[1] + zc[0]] ) + + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[0]] + u[1] * data[xc[1] + yc[2] + zc[0]] + u[2] * data[xc[2] + yc[2] + zc[0]] + u[3] * data[xc[3] + yc[2] + zc[0]] ) + + v[3] * ( u[0] * data[xc[0] + yc[3] + zc[0]] + u[1] * data[xc[1] + yc[3] + zc[0]] + u[2] * data[xc[2] + yc[3] + zc[0]] + u[3] * data[xc[3] + yc[3] + zc[0]] ) ) + + w[1] * ( v[0] * ( u[0] * data[xc[0] + yc[0] + zc[1]] + u[1] * data[xc[1] + yc[0] + zc[1]] + u[2] * data[xc[2] + yc[0] + zc[1]] + u[3] * data[xc[3] + yc[0] + zc[1]] ) + + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[1]] + u[1] * data[xc[1] + yc[1] + zc[1]] + u[2] * data[xc[2] + yc[1] + zc[1]] + u[3] * data[xc[3] + yc[1] + zc[1]] ) + + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[1]] + u[1] * data[xc[1] + yc[2] + zc[1]] + u[2] * data[xc[2] + yc[2] + zc[1]] + u[3] * data[xc[3] + yc[2] + zc[1]] ) + + v[3] * ( u[0] * data[xc[0] + yc[3] + zc[1]] + u[1] * data[xc[1] + yc[3] + zc[1]] + u[2] * data[xc[2] + yc[3] + zc[1]] + u[3] * data[xc[3] + yc[3] + zc[1]] ) ) + + w[2] * ( v[0] * ( u[0] * data[xc[0] + yc[0] + zc[2]] + u[1] * data[xc[1] + yc[0] + zc[2]] + u[2] * data[xc[2] + yc[0] + zc[2]] + u[3] * data[xc[3] + yc[0] + zc[2]] ) + + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[2]] + u[1] * data[xc[1] + yc[1] + zc[2]] + u[2] * data[xc[2] + yc[1] + zc[2]] + u[3] * data[xc[3] + yc[1] + zc[2]] ) + + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[2]] + u[1] * data[xc[1] + yc[2] + zc[2]] + u[2] * data[xc[2] + yc[2] + zc[2]] + u[3] * data[xc[3] + yc[2] + zc[2]] ) + + v[3] * ( u[0] * data[xc[0] + yc[3] + zc[2]] + u[1] * data[xc[1] + yc[3] + zc[2]] + u[2] * data[xc[2] + yc[3] + zc[2]] + u[3] * data[xc[3] + yc[3] + zc[2]] ) ) + + w[3] * ( v[0] * ( u[0] * data[xc[0] + yc[0] + zc[3]] + u[1] * data[xc[1] + yc[0] + zc[3]] + u[2] * data[xc[2] + yc[0] + zc[3]] + u[3] * data[xc[3] + yc[0] + zc[3]] ) + + v[1] * ( u[0] * data[xc[0] + yc[1] + zc[3]] + u[1] * data[xc[1] + yc[1] + zc[3]] + u[2] * data[xc[2] + yc[1] + zc[3]] + u[3] * data[xc[3] + yc[1] + zc[3]] ) + + v[2] * ( u[0] * data[xc[0] + yc[2] + zc[3]] + u[1] * data[xc[1] + yc[2] + zc[3]] + u[2] * data[xc[2] + yc[2] + zc[3]] + u[3] * data[xc[3] + yc[2] + zc[3]] ) + + v[3] * ( u[0] * data[xc[0] + yc[3] + zc[3]] + u[1] * data[xc[1] + yc[3] + zc[3]] + u[2] * data[xc[2] + yc[3] + zc[3]] + u[3] * data[xc[3] + yc[3] + zc[3]] ) ); } return 0.f; diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c index 194a164216a..0463e6ea00b 100644 --- a/source/blender/blenlib/intern/winstuff.c +++ b/source/blender/blenlib/intern/winstuff.c @@ -225,21 +225,21 @@ int check_file_chars(char *filename) #include <string.h> char* dirname(char *path) { - char *p; - if( path == NULL || *path == '\0' ) - return "."; - p = path + strlen(path) - 1; - while( *p == '/' ) { - if( p == path ) - return path; - *p-- = '\0'; - } - while( p >= path && *p != '/' ) - p--; - return - p < path ? "." : - p == path ? "/" : - (*p = '\0', path); + char *p; + if( path == NULL || *path == '\0' ) + return "."; + p = path + strlen(path) - 1; + while( *p == '/' ) { + if( p == path ) + return path; + *p-- = '\0'; + } + while( p >= path && *p != '/' ) + p--; + return + p < path ? "." : + p == path ? "/" : + (*p = '\0', path); } /* End of copied part */ |