Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2011-11-13 03:12:30 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2011-11-13 03:12:30 +0400
commit0ca96e1eb1da42268c11c286c74e79ed31da2c37 (patch)
tree52bcd0a8f871b8cb491a7604ed1c8001832e78fc /source/blender/blenlib
parent1ae159bff4c9c1d2e26df81744ab73c388b3bbe1 (diff)
parentfc42a6185ddeb6a24ec92287dfa7b89beb059716 (diff)
Merged changes in the trunk up to revision 41768.
Conflicts resolved: source/blender/makesdna/intern/makesdna.c source/blender/makesrna/RNA_enum_types.h source/blender/render/intern/source/shadeinput.c source/blenderplayer/bad_level_call_stubs/stubs.c Additional changes: * source/blender/makesrna/intern/rna_linestyle.c: Fixed white space issues that generated a number of compiler errors. The problem was that two string literals for enumerating MA_RAMP_SOFT and MA_RAMP_LINEAR contained a space. The string literals are supposed to represent a valid C identifier because of their use for automatic code generation. * Stroke transparency has been temporarily disabled due to a functionality conflict with some merged changes. A fix of this issue is planned.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_fnmatch.h2
-rw-r--r--source/blender/blenlib/BLI_math_geom.h2
-rw-r--r--source/blender/blenlib/BLI_pbvh.h2
-rw-r--r--source/blender/blenlib/BLI_threads.h4
-rw-r--r--source/blender/blenlib/BLI_vfontdata.h6
-rw-r--r--source/blender/blenlib/intern/BLI_heap.c6
-rw-r--r--source/blender/blenlib/intern/edgehash.c2
-rw-r--r--source/blender/blenlib/intern/math_geom.c27
-rw-r--r--source/blender/blenlib/intern/math_matrix.c6
-rw-r--r--source/blender/blenlib/intern/math_rotation.c28
-rw-r--r--source/blender/blenlib/intern/pbvh.c12
-rw-r--r--source/blender/blenlib/intern/scanfill.c2
-rw-r--r--source/blender/blenlib/intern/threads.c14
13 files changed, 81 insertions, 32 deletions
diff --git a/source/blender/blenlib/BLI_fnmatch.h b/source/blender/blenlib/BLI_fnmatch.h
index 94ae741250f..c09a7c7c0d2 100644
--- a/source/blender/blenlib/BLI_fnmatch.h
+++ b/source/blender/blenlib/BLI_fnmatch.h
@@ -63,7 +63,7 @@ extern "C" {
/* Match STRING against the filename pattern PATTERN,
returning zero if it matches, FNM_NOMATCH if not. */
extern int fnmatch __P ((const char *__pattern, const char *__string,
- int __flags));
+ int __flags));
#ifdef __cplusplus
}
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index 713466f13f8..99687ae8bb4 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -58,7 +58,9 @@ float area_poly_v3(int nr, float verts[][3], const float normal[3]);
float dist_to_line_v2(const float p[2], const float l1[2], const float l2[2]);
float dist_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2]);
+void closest_to_line_segment_v2(float closest[2], const float p[2], const float l1[2], const float l2[2]);
+float dist_to_plane_v3(const float p[2], const float plane_co[3], const float plane_no[2]);
float dist_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]);
float closest_to_line_v3(float r[3], const float p[3], const float l1[3], const float l2[3]);
float closest_to_line_v2(float r[2], const float p[2], const float l1[2], const float l2[2]);
diff --git a/source/blender/blenlib/BLI_pbvh.h b/source/blender/blenlib/BLI_pbvh.h
index c25243a9d36..e17a37c0a12 100644
--- a/source/blender/blenlib/BLI_pbvh.h
+++ b/source/blender/blenlib/BLI_pbvh.h
@@ -77,7 +77,7 @@ void BLI_pbvh_search_gather(PBVH *bvh,
hit first */
void BLI_pbvh_raycast(PBVH *bvh, BLI_pbvh_HitOccludedCallback cb, void *data,
- float ray_start[3], float ray_normal[3], int original);
+ float ray_start[3], float ray_normal[3], int original);
int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3],
float ray_start[3], float ray_normal[3], float *dist);
diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h
index 1c9c9188e44..a513b9f9e85 100644
--- a/source/blender/blenlib/BLI_threads.h
+++ b/source/blender/blenlib/BLI_threads.h
@@ -56,6 +56,10 @@ void BLI_remove_threads(struct ListBase *threadbase);
void BLI_end_threads (struct ListBase *threadbase);
int BLI_thread_is_main(void);
+
+void BLI_begin_threaded_malloc(void);
+void BLI_end_threaded_malloc(void);
+
/* System Information */
int BLI_system_thread_count(void); /* gets the number of threads the system can make use of */
diff --git a/source/blender/blenlib/BLI_vfontdata.h b/source/blender/blenlib/BLI_vfontdata.h
index ef6608e2c25..e858e784991 100644
--- a/source/blender/blenlib/BLI_vfontdata.h
+++ b/source/blender/blenlib/BLI_vfontdata.h
@@ -47,13 +47,13 @@ typedef struct VFontData {
// float resol[MAX_VF_CHARS];
// float width[MAX_VF_CHARS];
// float *points[MAX_VF_CHARS];
- char name[128];
+ char name[128];
} VFontData;
typedef struct VChar {
struct VChar *next, *prev;
- ListBase nurbsbase;
- intptr_t index;
+ ListBase nurbsbase;
+ intptr_t index;
float resol;
float width;
float *points;
diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c
index 52365371421..62a38e7933a 100644
--- a/source/blender/blenlib/intern/BLI_heap.c
+++ b/source/blender/blenlib/intern/BLI_heap.c
@@ -62,8 +62,10 @@ struct Heap {
#define HEAP_COMPARE(a, b) (a->value < b->value)
#define HEAP_EQUALS(a, b) (a->value == b->value)
#define HEAP_SWAP(heap, i, j) \
- { SWAP(int, heap->tree[i]->index, heap->tree[j]->index); \
- SWAP(HeapNode*, heap->tree[i], heap->tree[j]); }
+{ \
+ SWAP(int, heap->tree[i]->index, heap->tree[j]->index); \
+ SWAP(HeapNode*, heap->tree[i], heap->tree[j]); \
+}
/***/
diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c
index 65c5dffa33c..0eda3e78824 100644
--- a/source/blender/blenlib/intern/edgehash.c
+++ b/source/blender/blenlib/intern/edgehash.c
@@ -85,7 +85,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;
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index b79ae9f0042..a135cb43882 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -207,6 +207,21 @@ float dist_to_line_segment_v2(const float v1[2], const float v2[2], const float
return sqrtf(rc[0]*rc[0]+ rc[1]*rc[1]);
}
+/* point closest to v1 on line v2-v3 in 2D */
+void closest_to_line_segment_v2(float closest[2], const float p[2], const float l1[2], const float l2[2])
+{
+ float lambda, cp[2];
+
+ lambda= closest_to_line_v2(cp,p, l1, l2);
+
+ if(lambda <= 0.0f)
+ copy_v2_v2(closest, l1);
+ else if(lambda >= 1.0f)
+ copy_v2_v2(closest, l2);
+ else
+ copy_v2_v2(closest, cp);
+}
+
/* point closest to v1 on line v2-v3 in 3D */
void closest_to_line_segment_v3(float closest[3], const float v1[3], const float v2[3], const float v3[3])
{
@@ -222,6 +237,18 @@ void closest_to_line_segment_v3(float closest[3], const float v1[3], const float
copy_v3_v3(closest, cp);
}
+/* signed distance from the point to the plane in 3D */
+float dist_to_plane_v3(const float p[2], const float plane_co[3], const float plane_no[2])
+{
+ float plane_no_unit[3];
+ float plane_co_other[3];
+
+ normalize_v3_v3(plane_no_unit, plane_no);
+ add_v3_v3v3(plane_co_other, plane_co, plane_no_unit);
+
+ return -line_point_factor_v3(p, plane_co, plane_co_other);
+}
+
/* distance v1 to line-piece v2-v3 in 3D */
float dist_to_line_segment_v3(const float v1[3], const float v2[3], const float v3[3])
{
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 241ab62e175..b2c9a5706a3 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -426,9 +426,9 @@ void mul_m3_v3_double(float mat[][3], double vec[3])
x=vec[0];
y=vec[1];
- vec[0]= x*mat[0][0] + y*mat[1][0] + mat[2][0]*vec[2];
- vec[1]= x*mat[0][1] + y*mat[1][1] + mat[2][1]*vec[2];
- vec[2]= x*mat[0][2] + y*mat[1][2] + mat[2][2]*vec[2];
+ vec[0]= x*(double)mat[0][0] + y*(double)mat[1][0] + (double)mat[2][0]*vec[2];
+ vec[1]= x*(double)mat[0][1] + y*(double)mat[1][1] + (double)mat[2][1]*vec[2];
+ vec[2]= x*(double)mat[0][2] + y*(double)mat[1][2] + (double)mat[2][2]*vec[2];
}
void add_m3_m3m3(float m1[][3], float m2[][3], float m3[][3])
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index 7fecbae8229..1637cd16161 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -211,7 +211,7 @@ void quat_to_mat4(float m[][4], const float q[4])
double q0, q1, q2, q3, qda,qdb,qdc,qaa,qab,qac,qbb,qbc,qcc;
#ifdef DEBUG
- if(!((q0=dot_qtqt(q, q))==0.0f || (fabs(q0-1.0) < QUAT_EPSILON))) {
+ if(!((q0=dot_qtqt(q, q))==0.0f || (fabsf(q0-1.0) < QUAT_EPSILON))) {
fprintf(stderr, "Warning! quat_to_mat4() called with non-normalized: size %.8f *** report a bug ***\n", (float)q0);
}
#endif
@@ -257,7 +257,7 @@ void mat3_to_quat(float *q, float wmat[][3])
/* work on a copy */
copy_m3_m3(mat, wmat);
- normalize_m3(mat); /* this is needed AND a NormalQuat in the end */
+ normalize_m3(mat); /* this is needed AND a 'normalize_qt' in the end */
tr= 0.25* (double)(1.0f+mat[0][0]+mat[1][1]+mat[2][2]);
@@ -271,31 +271,31 @@ void mat3_to_quat(float *q, float wmat[][3])
}
else {
if(mat[0][0] > mat[1][1] && mat[0][0] > mat[2][2]) {
- s= 2.0*sqrtf(1.0f + mat[0][0] - mat[1][1] - mat[2][2]);
+ s= 2.0f*sqrtf(1.0f + mat[0][0] - mat[1][1] - mat[2][2]);
q[1]= (float)(0.25*s);
s= 1.0/s;
- q[0]= (float)((mat[2][1] - mat[1][2])*s);
- q[2]= (float)((mat[1][0] + mat[0][1])*s);
- q[3]= (float)((mat[2][0] + mat[0][2])*s);
+ q[0]= (float)((double)(mat[2][1] - mat[1][2])*s);
+ q[2]= (float)((double)(mat[1][0] + mat[0][1])*s);
+ q[3]= (float)((double)(mat[2][0] + mat[0][2])*s);
}
else if(mat[1][1] > mat[2][2]) {
- s= 2.0*sqrtf(1.0f + mat[1][1] - mat[0][0] - mat[2][2]);
+ s= 2.0f*sqrtf(1.0f + mat[1][1] - mat[0][0] - mat[2][2]);
q[2]= (float)(0.25*s);
s= 1.0/s;
- q[0]= (float)((mat[2][0] - mat[0][2])*s);
- q[1]= (float)((mat[1][0] + mat[0][1])*s);
- q[3]= (float)((mat[2][1] + mat[1][2])*s);
+ q[0]= (float)((double)(mat[2][0] - mat[0][2])*s);
+ q[1]= (float)((double)(mat[1][0] + mat[0][1])*s);
+ q[3]= (float)((double)(mat[2][1] + mat[1][2])*s);
}
else {
- s= 2.0*sqrtf(1.0 + mat[2][2] - mat[0][0] - mat[1][1]);
+ s= 2.0f*sqrtf(1.0f + mat[2][2] - mat[0][0] - mat[1][1]);
q[3]= (float)(0.25*s);
s= 1.0/s;
- q[0]= (float)((mat[1][0] - mat[0][1])*s);
- q[1]= (float)((mat[2][0] + mat[0][2])*s);
- q[2]= (float)((mat[2][1] + mat[1][2])*s);
+ q[0]= (float)((double)(mat[1][0] - mat[0][1])*s);
+ q[1]= (float)((double)(mat[2][0] + mat[0][2])*s);
+ q[2]= (float)((double)(mat[2][1] + mat[1][2])*s);
}
}
diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c
index 5a8e378e8c4..0ac6e0ba4df 100644
--- a/source/blender/blenlib/intern/pbvh.c
+++ b/source/blender/blenlib/intern/pbvh.c
@@ -507,13 +507,13 @@ static void build_sub(PBVH *bvh, int node_index, BB *cb, BBC *prim_bbc,
bvh->nodes[node_index].orig_vb= bvh->nodes[node_index].vb;
end = partition_indices(bvh->prim_indices, offset, offset + count - 1,
- axis,
- (cb->bmax[axis] + cb->bmin[axis]) * 0.5f,
- prim_bbc);
+ axis,
+ (cb->bmax[axis] + cb->bmin[axis]) * 0.5f,
+ prim_bbc);
check_partitioning(bvh->prim_indices, offset, offset + count - 1,
- axis,
- (cb->bmax[axis] + cb->bmin[axis]) * 0.5f,
- prim_bbc, end);
+ axis,
+ (cb->bmax[axis] + cb->bmin[axis]) * 0.5f,
+ prim_bbc, end);
build_sub(bvh, bvh->nodes[node_index].children_offset, NULL,
prim_bbc, offset, end - offset);
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c
index 4bd17fcf0b9..41b1fea32a6 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -165,7 +165,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;
}
}
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index 8247b861a7a..98d2179e2dd 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -669,3 +669,17 @@ void BLI_thread_queue_nowait(ThreadQueue *queue)
pthread_mutex_unlock(&queue->mutex);
}
+void BLI_begin_threaded_malloc(void)
+{
+ if(thread_levels == 0) {
+ MEM_set_lock_callback(BLI_lock_malloc_thread, BLI_unlock_malloc_thread);
+ }
+ thread_levels++;
+}
+
+void BLI_end_threaded_malloc(void)
+{
+ thread_levels--;
+ if(thread_levels==0)
+ MEM_set_lock_callback(NULL, NULL);
+}