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:
authorDaniel Genrich <daniel.genrich@gmx.net>2008-05-14 20:09:56 +0400
committerDaniel Genrich <daniel.genrich@gmx.net>2008-05-14 20:09:56 +0400
commit4d8b5587b867e53c22b4f3f3c56ba8714e9b7bfb (patch)
treebaa86e0249e2b445ee90b04cf7844778638a0aa0 /source/blender/blenlib
parent83c2acccfbf311780b7fc3ea7aa8b5e0f4e03242 (diff)
Pre merge commit (includes commented moving stuff)
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index 0d130cd37da..b3f11039ce1 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -46,6 +46,41 @@
#include <omp.h>
#endif
+#include <time.h>
+
+/* Util macros */
+#define TO_STR(a) #a
+#define JOIN(a,b) a##b
+
+/* Benchmark macros */
+#if 1
+
+#define BENCH(a) \
+ do { \
+ clock_t _clock_init = clock(); \
+ (a); \
+ printf("%s: %fms\n", #a, (float)(clock()-_clock_init)*1000/CLOCKS_PER_SEC); \
+} while(0)
+
+#define BENCH_VAR(name) clock_t JOIN(_bench_step,name) = 0, JOIN(_bench_total,name) = 0
+#define BENCH_BEGIN(name) JOIN(_bench_step, name) = clock()
+#define BENCH_END(name) JOIN(_bench_total,name) += clock() - JOIN(_bench_step,name)
+#define BENCH_RESET(name) JOIN(_bench_total, name) = 0
+#define BENCH_REPORT(name) printf("%s: %fms\n", TO_STR(name), JOIN(_bench_total,name)*1000.0f/CLOCKS_PER_SEC)
+
+#else
+
+#define BENCH(a) (a)
+#define BENCH_VAR(name)
+#define BENCH_BEGIN(name)
+#define BENCH_END(name)
+#define BENCH_RESET(name)
+#define BENCH_REPORT(name)
+
+#endif
+
+
+
typedef struct BVHNode
{
struct BVHNode *children[8]; // max 8 children
@@ -61,7 +96,7 @@ struct BVHTree
{
BVHNode **nodes;
BVHNode *nodearray; /* pre-alloc branch nodes */
- float epsilon; /* epslion is used for inflation of the k-dop */
+ float epsilon; /* epsilon is used for inflation of the k-dop */
int totleaf; // leafs
int totbranch;
char tree_type; // type of tree (4 => quadtree)