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:
authorHoward Trickey <howard.trickey@gmail.com>2020-08-02 16:35:20 +0300
committerHoward Trickey <howard.trickey@gmail.com>2020-08-02 16:35:20 +0300
commitb9845566b4b70222ea8e738cccb43cb5b7578759 (patch)
tree285ef05797ea77aeb652252578bd34be371146a3 /source/blender/blenlib
parent771da552bb4d56f551f576546ec2d1cbc1b863f7 (diff)
parent4f27e94146fdde945f5b09c9e4efe38ca760635f (diff)
Merge branch 'master' into newboolean.
Also, make it possible to build when WITH_GMP is disabled.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_boolean.hh9
-rw-r--r--source/blender/blenlib/BLI_delaunay_2d.h6
-rw-r--r--source/blender/blenlib/BLI_dial_2d.h4
-rw-r--r--source/blender/blenlib/BLI_math_mpq.hh5
-rw-r--r--source/blender/blenlib/BLI_mesh_intersect.hh26
-rw-r--r--source/blender/blenlib/BLI_mpq2.hh7
-rw-r--r--source/blender/blenlib/BLI_mpq3.hh11
-rw-r--r--source/blender/blenlib/BLI_uvproject.h2
-rw-r--r--source/blender/blenlib/intern/BLI_dial_2d.c2
-rw-r--r--source/blender/blenlib/intern/boolean.cc44
-rw-r--r--source/blender/blenlib/intern/delaunay_2d.cc14
-rw-r--r--source/blender/blenlib/intern/math_vec.cc2
-rw-r--r--source/blender/blenlib/intern/mesh_intersect.cc157
-rw-r--r--source/blender/blenlib/intern/session_uuid.c2
-rw-r--r--source/blender/blenlib/intern/uvproject.c2
15 files changed, 170 insertions, 123 deletions
diff --git a/source/blender/blenlib/BLI_boolean.hh b/source/blender/blenlib/BLI_boolean.hh
index 13fffcee634..2b39f494950 100644
--- a/source/blender/blenlib/BLI_boolean.hh
+++ b/source/blender/blenlib/BLI_boolean.hh
@@ -21,8 +21,11 @@
* \ingroup bli
*/
-#include "BLI_mesh_intersect.hh"
-#include <functional>
+/* The boolean functions in Blenlib use exact arithmetic, so require GMP. */
+#ifdef WITH_GMP
+
+# include "BLI_mesh_intersect.hh"
+# include <functional>
namespace blender::meshintersect {
@@ -70,4 +73,6 @@ Mesh boolean_trimesh(Mesh &tm,
MArena *arena);
} // namespace blender::meshintersect
+
+#endif /* WITH_GMP */
#endif /* __BLI_BOOLEAN_HH__ */
diff --git a/source/blender/blenlib/BLI_delaunay_2d.h b/source/blender/blenlib/BLI_delaunay_2d.h
index edbb7cc692d..d5b5e8f59db 100644
--- a/source/blender/blenlib/BLI_delaunay_2d.h
+++ b/source/blender/blenlib/BLI_delaunay_2d.h
@@ -218,9 +218,13 @@ template<typename Arith_t> struct vec2_impl;
template<> struct vec2_impl<double> {
typedef double2 type;
};
+
+# ifdef WITH_GMP
template<> struct vec2_impl<mpq_class> {
typedef mpq2 type;
};
+# endif
+
template<typename Arith_t> using vec2 = typename vec2_impl<Arith_t>::type;
template<typename Arith_t> class CDT_input {
@@ -255,8 +259,10 @@ template<typename Arith_t> class CDT_result {
CDT_result<double> delaunay_2d_calc(const CDT_input<double> &input, CDT_output_type output_type);
+# ifdef WITH_GMP
CDT_result<mpq_class> delaunay_2d_calc(const CDT_input<mpq_class> &input,
CDT_output_type output_type);
+# endif
} /* namespace blender::meshintersect */
diff --git a/source/blender/blenlib/BLI_dial_2d.h b/source/blender/blenlib/BLI_dial_2d.h
index a39543720e6..83467881eb5 100644
--- a/source/blender/blenlib/BLI_dial_2d.h
+++ b/source/blender/blenlib/BLI_dial_2d.h
@@ -38,7 +38,7 @@
* float angle;
* Dial *dial;
*
- * dial = BLI_dial_initialize(start_position, threshold);
+ * dial = BLI_dial_init(start_position, threshold);
*
* angle = BLI_dial_angle(dial, current_position);
*
@@ -52,7 +52,7 @@ extern "C" {
typedef struct Dial Dial;
-Dial *BLI_dial_initialize(const float start_position[2], float threshold);
+Dial *BLI_dial_init(const float start_position[2], float threshold);
float BLI_dial_angle(Dial *dial, const float current_position[2]);
diff --git a/source/blender/blenlib/BLI_math_mpq.hh b/source/blender/blenlib/BLI_math_mpq.hh
index 06fa0a2e257..cec2a8956f2 100644
--- a/source/blender/blenlib/BLI_math_mpq.hh
+++ b/source/blender/blenlib/BLI_math_mpq.hh
@@ -17,6 +17,8 @@
#ifndef __BLI_MATH_MPQ_HH__
#define __BLI_MATH_MPQ_HH__
+#ifdef WITH_GMP
+
/* This file uses an external file header to define the multiprecision
* rational type, mpq_class.
* This class keeps separate multiprecision integer numerator and
@@ -26,6 +28,7 @@
* See gmplib.org for full documentation. In particular:
* https://gmplib.org/manual/C_002b_002b-Interface-Rationals
*/
-#include "gmpxx.h"
+# include "gmpxx.h"
+#endif /* WITH_GMP */
#endif /* __BLI_MATH_MPQ_HH__ */
diff --git a/source/blender/blenlib/BLI_mesh_intersect.hh b/source/blender/blenlib/BLI_mesh_intersect.hh
index 30a7f43f3b0..061ecdf66ce 100644
--- a/source/blender/blenlib/BLI_mesh_intersect.hh
+++ b/source/blender/blenlib/BLI_mesh_intersect.hh
@@ -20,19 +20,22 @@
/** \file
* \ingroup bli
*
- * Work in progress on mesh intersection library function.
+ * Mesh intersection library functions.
+ * Uses exact arithmetic, so need GMP.
*/
-#include <iostream>
+#ifdef WITH_GMP
-#include "BLI_array.hh"
-#include "BLI_double3.hh"
-#include "BLI_index_range.hh"
-#include "BLI_map.hh"
-#include "BLI_math_mpq.hh"
-#include "BLI_mpq3.hh"
-#include "BLI_span.hh"
-#include "BLI_vector.hh"
+# include <iostream>
+
+# include "BLI_array.hh"
+# include "BLI_double3.hh"
+# include "BLI_index_range.hh"
+# include "BLI_map.hh"
+# include "BLI_math_mpq.hh"
+# include "BLI_mpq3.hh"
+# include "BLI_span.hh"
+# include "BLI_vector.hh"
namespace blender::meshintersect {
@@ -353,4 +356,5 @@ void write_obj_mesh(Mesh &m, const std::string &objname);
} /* namespace blender::meshintersect */
-#endif /* __BLI_MESH_INTERSECT_HH__ */
+#endif /* WITH_GMP */
+#endif /* __BLI_MESH_INTERSECT_HH__ */ \ No newline at end of file
diff --git a/source/blender/blenlib/BLI_mpq2.hh b/source/blender/blenlib/BLI_mpq2.hh
index 771115ca041..a78ffaaa32d 100644
--- a/source/blender/blenlib/BLI_mpq2.hh
+++ b/source/blender/blenlib/BLI_mpq2.hh
@@ -17,8 +17,10 @@
#ifndef __BLI_MPQ2_HH__
#define __BLI_MPQ2_HH__
-#include "BLI_math_mpq.hh"
-#include "BLI_mpq3.hh"
+#ifdef WITH_GMP
+
+# include "BLI_math_mpq.hh"
+# include "BLI_mpq3.hh"
namespace blender {
@@ -174,4 +176,5 @@ struct mpq2 {
} // namespace blender
+#endif /* WITH_GMP */
#endif /* __BLI_MPQ_HH__ */
diff --git a/source/blender/blenlib/BLI_mpq3.hh b/source/blender/blenlib/BLI_mpq3.hh
index cfe75b1d4c5..0c9edb5a440 100644
--- a/source/blender/blenlib/BLI_mpq3.hh
+++ b/source/blender/blenlib/BLI_mpq3.hh
@@ -17,11 +17,13 @@
#ifndef __BLI_MPQ3_HH__
#define __BLI_MPQ3_HH__
-#include <iostream>
+#ifdef WITH_GMP
-#include "BLI_math.h"
-#include "BLI_math_mpq.hh"
-#include "BLI_span.hh"
+# include <iostream>
+
+# include "BLI_math.h"
+# include "BLI_math_mpq.hh"
+# include "BLI_span.hh"
namespace blender {
@@ -270,4 +272,5 @@ uint64_t hash_mpq_class(const mpq_class &value);
} // namespace blender
+#endif /* WITH_GMP */
#endif /* __BLI_MPQ3_HH__ */
diff --git a/source/blender/blenlib/BLI_uvproject.h b/source/blender/blenlib/BLI_uvproject.h
index 8a33ea6961c..4bfa1601b16 100644
--- a/source/blender/blenlib/BLI_uvproject.h
+++ b/source/blender/blenlib/BLI_uvproject.h
@@ -45,7 +45,7 @@ void BLI_uvproject_from_view(float target[2],
float winy);
/* apply ortho uv's */
-void BLI_uvproject_from_view_ortho(float target[2], float source[3], float rotmat[4][4]);
+void BLI_uvproject_from_view_ortho(float target[2], float source[3], const float rotmat[4][4]);
/* so we can adjust scale with keeping the struct private */
void BLI_uvproject_camera_info_scale(struct ProjCameraInfo *uci, float scale_x, float scale_y);
diff --git a/source/blender/blenlib/intern/BLI_dial_2d.c b/source/blender/blenlib/intern/BLI_dial_2d.c
index c6d28e20f35..7363233d573 100644
--- a/source/blender/blenlib/intern/BLI_dial_2d.c
+++ b/source/blender/blenlib/intern/BLI_dial_2d.c
@@ -45,7 +45,7 @@ struct Dial {
bool initialized;
};
-Dial *BLI_dial_initialize(const float start_position[2], float threshold)
+Dial *BLI_dial_init(const float start_position[2], float threshold)
{
Dial *dial = MEM_callocN(sizeof(Dial), "dial");
diff --git a/source/blender/blenlib/intern/boolean.cc b/source/blender/blenlib/intern/boolean.cc
index 6f29320b556..ab4b6ea17b4 100644
--- a/source/blender/blenlib/intern/boolean.cc
+++ b/source/blender/blenlib/intern/boolean.cc
@@ -14,26 +14,28 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include <algorithm>
-#include <fstream>
-#include <iostream>
-
-#include "BLI_array.hh"
-#include "BLI_assert.h"
-#include "BLI_delaunay_2d.h"
-#include "BLI_hash.hh"
-#include "BLI_map.hh"
-#include "BLI_math.h"
-#include "BLI_math_mpq.hh"
-#include "BLI_mesh_intersect.hh"
-#include "BLI_mpq3.hh"
-#include "BLI_set.hh"
-#include "BLI_span.hh"
-#include "BLI_stack.hh"
-#include "BLI_vector.hh"
-#include "BLI_vector_set.hh"
-
-#include "BLI_boolean.hh"
+#ifdef WITH_GMP
+
+# include <algorithm>
+# include <fstream>
+# include <iostream>
+
+# include "BLI_array.hh"
+# include "BLI_assert.h"
+# include "BLI_delaunay_2d.h"
+# include "BLI_hash.hh"
+# include "BLI_map.hh"
+# include "BLI_math.h"
+# include "BLI_math_mpq.hh"
+# include "BLI_mesh_intersect.hh"
+# include "BLI_mpq3.hh"
+# include "BLI_set.hh"
+# include "BLI_span.hh"
+# include "BLI_stack.hh"
+# include "BLI_vector.hh"
+# include "BLI_vector_set.hh"
+
+# include "BLI_boolean.hh"
namespace blender::meshintersect {
@@ -2785,3 +2787,5 @@ Mesh boolean_mesh(Mesh &pm,
}
} // namespace blender::meshintersect
+
+#endif // WITH_GMP \ No newline at end of file
diff --git a/source/blender/blenlib/intern/delaunay_2d.cc b/source/blender/blenlib/intern/delaunay_2d.cc
index 11be4f99d56..87b7dd8dd01 100644
--- a/source/blender/blenlib/intern/delaunay_2d.cc
+++ b/source/blender/blenlib/intern/delaunay_2d.cc
@@ -39,10 +39,12 @@ template<typename T> T math_abs(const T v)
return (v < 0) ? -v : v;
}
+#ifdef WITH_GMP
template<> mpq_class math_abs<mpq_class>(const mpq_class v)
{
return abs(v);
}
+#endif
template<> double math_abs<double>(const double v)
{
@@ -55,10 +57,12 @@ template<typename T> double math_to_double(const T UNUSED(v))
return 0.0;
}
+#ifdef WITH_GMP
template<> double math_to_double<mpq_class>(const mpq_class v)
{
return v.get_d();
}
+#endif
template<> double math_to_double<double>(const double v)
{
@@ -1404,7 +1408,11 @@ void fill_crossdata_for_intersect(const vec2<T> &curco,
T &lambda = isect.lambda;
switch (isect.kind) {
case vec2<T>::isect_result::LINE_LINE_CROSS: {
+#ifdef WITH_GMP
if (!std::is_same<T, mpq_class>::value) {
+#else
+ if (true) {
+#endif
T len_ab = vec2<T>::distance(va->co, vb->co);
if (lambda * len_ab <= epsilon) {
fill_crossdata_for_through_vert(va, se_vcva, cd, cd_next);
@@ -1441,9 +1449,11 @@ void fill_crossdata_for_intersect(const vec2<T> &curco,
}
} break;
case vec2<T>::isect_result::LINE_LINE_NONE: {
+#ifdef WITH_GMP
if (std::is_same<T, mpq_class>::value) {
BLI_assert(false);
}
+#endif
/* It should be very near one end or other of segment. */
const T middle_lambda = 0.5;
if (lambda <= middle_lambda) {
@@ -1462,7 +1472,7 @@ void fill_crossdata_for_intersect(const vec2<T> &curco,
}
} break;
}
-}
+} // namespace blender::meshintersect
/*
* As part of finding the crossings of a ray to v2, find the next crossing after 'cd', assuming
@@ -2307,11 +2317,13 @@ blender::meshintersect::CDT_result<double> delaunay_2d_calc(const CDT_input<doub
return delaunay_calc(input, output_type);
}
+#ifdef WITH_GMP
blender::meshintersect::CDT_result<mpq_class> delaunay_2d_calc(const CDT_input<mpq_class> &input,
CDT_output_type output_type)
{
return delaunay_calc(input, output_type);
}
+#endif
} /* namespace blender::meshintersect */
diff --git a/source/blender/blenlib/intern/math_vec.cc b/source/blender/blenlib/intern/math_vec.cc
index 1b87c820815..7d81908e298 100644
--- a/source/blender/blenlib/intern/math_vec.cc
+++ b/source/blender/blenlib/intern/math_vec.cc
@@ -91,6 +91,7 @@ double2::isect_result double2::isect_seg_seg(const double2 &v1,
return ans;
}
+#ifdef WITH_GMP
mpq2::isect_result mpq2::isect_seg_seg(const mpq2 &v1,
const mpq2 &v2,
const mpq2 &v3,
@@ -235,6 +236,7 @@ int mpq3::orient3d(const mpq3 &a, const mpq3 &b, const mpq3 &c, const mpq3 &d)
mpq_class det = adz * (bdxcdy - cdxbdy) + bdz * (cdxady - adxcdy) + cdz * (adxbdy - bdxady);
return sgn(det);
}
+#endif /* WITH_GMP */
/* For double versions of orient and incircle functions, use robust predicates
* that give exact answers for double inputs.
diff --git a/source/blender/blenlib/intern/mesh_intersect.cc b/source/blender/blenlib/intern/mesh_intersect.cc
index 203cbd7c1fc..89dceddd95b 100644
--- a/source/blender/blenlib/intern/mesh_intersect.cc
+++ b/source/blender/blenlib/intern/mesh_intersect.cc
@@ -14,40 +14,43 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include <fstream>
-#include <iostream>
-
-#include "BLI_allocator.hh"
-#include "BLI_array.hh"
-#include "BLI_assert.h"
-#include "BLI_delaunay_2d.h"
-#include "BLI_double3.hh"
-#include "BLI_float3.hh"
-#include "BLI_hash.hh"
-#include "BLI_kdopbvh.h"
-#include "BLI_map.hh"
-#include "BLI_math_mpq.hh"
-#include "BLI_mpq2.hh"
-#include "BLI_mpq3.hh"
-#include "BLI_span.hh"
-#include "BLI_task.h"
-#include "BLI_threads.h"
-#include "BLI_vector.hh"
-#include "BLI_vector_set.hh"
-
-#include "BLI_mesh_intersect.hh"
+/* The blender::meshintersect API needs GMP. */
+#ifdef WITH_GMP
+
+# include <fstream>
+# include <iostream>
+
+# include "BLI_allocator.hh"
+# include "BLI_array.hh"
+# include "BLI_assert.h"
+# include "BLI_delaunay_2d.h"
+# include "BLI_double3.hh"
+# include "BLI_float3.hh"
+# include "BLI_hash.hh"
+# include "BLI_kdopbvh.h"
+# include "BLI_map.hh"
+# include "BLI_math_mpq.hh"
+# include "BLI_mpq2.hh"
+# include "BLI_mpq3.hh"
+# include "BLI_span.hh"
+# include "BLI_task.h"
+# include "BLI_threads.h"
+# include "BLI_vector.hh"
+# include "BLI_vector_set.hh"
+
+# include "BLI_mesh_intersect.hh"
// #define PERFDEBUG
namespace blender::meshintersect {
-#ifdef PERFDEBUG
+# ifdef PERFDEBUG
static void perfdata_init(void);
static void incperfcount(int countnum);
static void bumpperfcount(int countnum, int amt);
static void doperfmax(int maxnum, int val);
static void dump_perfdata(void);
-#endif
+# endif
/* For debugging, can disable threading in intersect code with this static constant. */
static constexpr bool intersect_use_threading = true;
@@ -363,21 +366,21 @@ class MArena::MArenaImpl {
int next_face_id_ = 0;
/* Need a lock when multithreading to protect allocation of new elements. */
-#ifdef USE_SPINLOCK
+# ifdef USE_SPINLOCK
SpinLock lock_;
-#else
+# else
ThreadMutex *mutex_;
-#endif
+# endif
public:
MArenaImpl()
{
if (intersect_use_threading) {
-#ifdef USE_SPINLOCK
+# ifdef USE_SPINLOCK
BLI_spin_init(&lock_);
-#else
+# else
mutex_ = BLI_mutex_alloc();
-#endif
+# endif
}
}
MArenaImpl(const MArenaImpl &) = delete;
@@ -385,11 +388,11 @@ class MArena::MArenaImpl {
~MArenaImpl()
{
if (intersect_use_threading) {
-#ifdef USE_SPINLOCK
+# ifdef USE_SPINLOCK
BLI_spin_end(&lock_);
-#else
+# else
BLI_mutex_free(mutex_);
-#endif
+# endif
}
}
@@ -426,19 +429,19 @@ class MArena::MArenaImpl {
{
Face *f = new Face(verts, next_face_id_++, orig, edge_origs, is_intersect);
if (intersect_use_threading) {
-#ifdef USE_SPINLOCK
+# ifdef USE_SPINLOCK
BLI_spin_lock(&lock_);
-#else
+# else
BLI_mutex_lock(mutex_);
-#endif
+# endif
}
allocated_faces_.append(std::unique_ptr<Face>(f));
if (intersect_use_threading) {
-#ifdef USE_SPINLOCK
+# ifdef USE_SPINLOCK
BLI_spin_unlock(&lock_);
-#else
+# else
BLI_mutex_unlock(mutex_);
-#endif
+# endif
}
return f;
}
@@ -462,11 +465,11 @@ class MArena::MArenaImpl {
Vert vtry(co, double3(), NO_INDEX, NO_INDEX);
VSetKey vskey(&vtry);
if (intersect_use_threading) {
-#ifdef USE_SPINLOCK
+# ifdef USE_SPINLOCK
BLI_spin_lock(&lock_);
-#else
+# else
BLI_mutex_lock(mutex_);
-#endif
+# endif
}
int i = vset_.index_of_try(vskey);
if (i == -1) {
@@ -476,11 +479,11 @@ class MArena::MArenaImpl {
ans = vset_[i].vert;
}
if (intersect_use_threading) {
-#ifdef USE_SPINLOCK
+# ifdef USE_SPINLOCK
BLI_spin_unlock(&lock_);
-#else
+# else
BLI_mutex_unlock(mutex_);
-#endif
+# endif
}
return ans;
}
@@ -510,11 +513,11 @@ class MArena::MArenaImpl {
Vertp ans;
VSetKey vskey(&vtry);
if (intersect_use_threading) {
-#ifdef USE_SPINLOCK
+# ifdef USE_SPINLOCK
BLI_spin_lock(&lock_);
-#else
+# else
BLI_mutex_lock(mutex_);
-#endif
+# endif
}
int i = vset_.index_of_try(vskey);
if (i == -1) {
@@ -534,11 +537,11 @@ class MArena::MArenaImpl {
ans = vset_[i].vert;
}
if (intersect_use_threading) {
-#ifdef USE_SPINLOCK
+# ifdef USE_SPINLOCK
BLI_spin_unlock(&lock_);
-#else
+# else
BLI_mutex_unlock(mutex_);
-#endif
+# endif
}
return ans;
};
@@ -1235,7 +1238,7 @@ static bool non_trivially_coplanar_intersects(const Mesh &tm,
/* Keeping this code for a while, but for now, almost all
* trivial intersects are found before calling intersect_tri_tri now.
*/
-#if 0
+# if 0
/* Do tri1 and tri2 intersect at all, and if so, is the intersection
* something other than a common vertex or a common edge?
* The itt value is the result of calling intersect_tri_tri on tri1, tri2.
@@ -1294,7 +1297,7 @@ static bool non_trivial_intersect(const ITT_value &itt, Facep tri1, Facep tri2)
const mpq2 *vb[] = {&tri_2d[1][0], &tri_2d[1][1], &tri_2d[1][2]};
return non_trivially_2d_intersect(va, vb);
}
-#endif
+# endif
/* The sup and index functions are defined in the paper:
* EXACT GEOMETRIC COMPUTATION USING CASCADING, by
@@ -1763,9 +1766,9 @@ static ITT_value itt_canon1(const mpq3 &p1,
static ITT_value intersect_tri_tri(const Mesh &tm, int t1, int t2)
{
constexpr int dbg_level = 0;
-#ifdef PERFDEBUG
+# ifdef PERFDEBUG
incperfcount(2); /* Intersect_tri_tri calls. */
-#endif
+# endif
const Face &tri1 = *tm.face(t1);
const Face &tri2 = *tm.face(t2);
Vertp vp1 = tri1[0];
@@ -1808,9 +1811,9 @@ static ITT_value intersect_tri_tri(const Mesh &tm, int t1, int t2)
int sq1 = filter_plane_side(d_q1, d_r2, d_n2, abs_d_q1, abs_d_r2, abs_d_n2);
int sr1 = filter_plane_side(d_r1, d_r2, d_n2, abs_d_r1, abs_d_r2, abs_d_n2);
if ((sp1 > 0 && sq1 > 0 && sr1 > 0) || (sp1 < 0 && sq1 < 0 && sr1 < 0)) {
-#ifdef PERFDEBUG
+# ifdef PERFDEBUG
incperfcount(3); /* Tri tri intersects decided by filter plane tests. */
-#endif
+# endif
if (dbg_level > 0) {
std::cout << "no intersection, all t1's verts above or below t2\n";
}
@@ -1826,9 +1829,9 @@ static ITT_value intersect_tri_tri(const Mesh &tm, int t1, int t2)
int sq2 = filter_plane_side(d_q2, d_r1, d_n1, abs_d_q2, abs_d_r1, abs_d_n1);
int sr2 = filter_plane_side(d_r2, d_r1, d_n1, abs_d_r2, abs_d_r1, abs_d_n1);
if ((sp2 > 0 && sq2 > 0 && sr2 > 0) || (sp2 < 0 && sq2 < 0 && sr2 < 0)) {
-#ifdef PERFDEBUG
+# ifdef PERFDEBUG
incperfcount(3); /* Tri tri intersects decided by filter plane tests. */
-#endif
+# endif
if (dbg_level > 0) {
std::cout << "no intersection, all t2's verts above or below t1\n";
}
@@ -1862,9 +1865,9 @@ static ITT_value intersect_tri_tri(const Mesh &tm, int t1, int t2)
if (dbg_level > 0) {
std::cout << "no intersection, all t1's verts above or below t2 (exact)\n";
}
-#ifdef PERFDEBUG
+# ifdef PERFDEBUG
incperfcount(4); /* Tri tri interects decided by exact plane tests. */
-#endif
+# endif
return ITT_value(INONE);
}
@@ -1888,9 +1891,9 @@ static ITT_value intersect_tri_tri(const Mesh &tm, int t1, int t2)
if (dbg_level > 0) {
std::cout << "no intersection, all t2's verts above or below t1 (exact)\n";
}
-#ifdef PERFDEBUG
+# ifdef PERFDEBUG
incperfcount(4); /* Tri tri interects decided by exact plane tests. */
-#endif
+# endif
return ITT_value(INONE);
}
@@ -1956,11 +1959,11 @@ static ITT_value intersect_tri_tri(const Mesh &tm, int t1, int t2)
ans.t_source = t2;
}
-#ifdef PERFDEBUG
+# ifdef PERFDEBUG
if (ans.kind != INONE) {
incperfcount(5);
}
-#endif
+# endif
return ans;
}
@@ -2540,9 +2543,9 @@ static void calc_subdivided_tris(Array<Mesh> &r_tri_subdivided,
if (!(len == 1 && overlap[overlap_index].indexB == t)) {
OverlapTriRange range = {t, overlap_index, len};
data.overlap_tri_range.append(range);
-#ifdef PERFDEBUG
+# ifdef PERFDEBUG
bumpperfcount(0, len); /* Overlaps. */
-#endif
+# endif
}
}
overlap_index = i + 1;
@@ -2766,12 +2769,12 @@ Mesh trimesh_nary_intersect(
if (dbg_level > 1) {
std::cout << clinfo;
}
-#ifdef PERFDEBUG
+# ifdef PERFDEBUG
perfdata_init();
doperfmax(0, static_cast<int>(tm_in.face_size()));
doperfmax(1, static_cast<int>(clinfo.tot_cluster()));
doperfmax(2, static_cast<int>(tri_ov.overlap().size()));
-#endif
+# endif
Array<CDT_data> cluster_subdivided(clinfo.tot_cluster());
for (int c : clinfo.index_range()) {
cluster_subdivided[c] = calc_cluster_subdivided(clinfo, c, tm_in, arena);
@@ -2793,9 +2796,9 @@ Mesh trimesh_nary_intersect(
std::cout << "TRIMESH_NARY_INTERSECT answer:\n";
std::cout << combined;
}
-#ifdef PERFDEBUG
+# ifdef PERFDEBUG
dump_perfdata();
-#endif
+# endif
return combined;
}
@@ -2850,11 +2853,11 @@ void write_obj_mesh(Mesh &m, const std::string &objname)
/* Would like to use BKE_tempdir_base() here, but that brings in dependence on kernel library.
* This is just for developer debugging anyway, and should never be called in production Blender.
*/
-#ifdef _WIN_32
+# ifdef _WIN_32
const char *objdir = BLI_getenv("HOME");
-#else
+# else
const char *objdir = "/tmp/";
-#endif
+# endif
if (m.face_size() == 0) {
return;
}
@@ -2890,7 +2893,7 @@ void write_obj_mesh(Mesh &m, const std::string &objname)
f.close();
}
-#ifdef PERFDEBUG
+# ifdef PERFDEBUG
struct PerfCounts {
Vector<int> count;
Vector<const char *> count_name;
@@ -2962,6 +2965,8 @@ static void dump_perfdata(void)
std::cout << perfdata.max_name[i] << " = " << perfdata.max[i] << "\n";
}
}
-#endif
+# endif
}; // namespace blender::meshintersect
+
+#endif // WITH_GMP \ No newline at end of file
diff --git a/source/blender/blenlib/intern/session_uuid.c b/source/blender/blenlib/intern/session_uuid.c
index a5307684059..d3446fae5cb 100644
--- a/source/blender/blenlib/intern/session_uuid.c
+++ b/source/blender/blenlib/intern/session_uuid.c
@@ -43,7 +43,7 @@ SessionUUID BLI_session_uuid_generate(void)
* Just request the UUID once again, hoping that there are no a lot of high-priority threads
* which will overflow the counter once again between the previous call and this one.
*
- * NOTE: It is possible to have collissions after such overflow. */
+ * NOTE: It is possible to have collisions after such overflow. */
result.uuid_ = atomic_add_and_fetch_uint64(&global_session_uuid.uuid_, 1);
}
return result;
diff --git a/source/blender/blenlib/intern/uvproject.c b/source/blender/blenlib/intern/uvproject.c
index a34c551767a..00fef29587c 100644
--- a/source/blender/blenlib/intern/uvproject.c
+++ b/source/blender/blenlib/intern/uvproject.c
@@ -183,7 +183,7 @@ ProjCameraInfo *BLI_uvproject_camera_info(Object *ob, float (*rotmat)[4], float
return NULL;
}
-void BLI_uvproject_from_view_ortho(float target[2], float source[3], float rotmat[4][4])
+void BLI_uvproject_from_view_ortho(float target[2], float source[3], const float rotmat[4][4])
{
float pv[3];