summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/array.cpp72
-rw-r--r--core/array.h3
-rw-r--r--core/debugger/remote_debugger.cpp35
-rw-r--r--core/debugger/remote_debugger.h11
-rw-r--r--core/input/input_event.cpp2
-rw-r--r--core/io/logger.cpp11
-rw-r--r--core/math/aabb.h28
-rw-r--r--core/math/geometry.cpp39
-rw-r--r--core/math/geometry.h2
-rw-r--r--core/math/octree.h18
-rw-r--r--core/math/transform_2d.cpp12
-rw-r--r--core/math/transform_2d.h11
-rw-r--r--core/math/triangle_mesh.cpp8
-rw-r--r--core/math/triangle_mesh.h4
-rw-r--r--core/os/os.h2
-rw-r--r--core/project_settings.cpp35
-rw-r--r--core/variant.h9
-rw-r--r--core/variant_call.cpp2
18 files changed, 198 insertions, 106 deletions
diff --git a/core/array.cpp b/core/array.cpp
index cd4e0fb4c8..7c0129ffde 100644
--- a/core/array.cpp
+++ b/core/array.cpp
@@ -285,59 +285,49 @@ Array Array::duplicate(bool p_deep) const {
return new_arr;
}
-int Array::_fix_slice_index(int p_index, int p_arr_len, int p_top_mod) {
- p_index = CLAMP(p_index, -p_arr_len, p_arr_len + p_top_mod);
- if (p_index < 0) {
- p_index = (p_index % p_arr_len + p_arr_len) % p_arr_len; // positive modulo
- }
- return p_index;
-}
+int Array::_clamp_slice_index(int p_index) const {
-int Array::_clamp_index(int p_index) const {
- return CLAMP(p_index, -size() + 1, size() - 1);
+ int arr_size = size();
+ int fixed_index = CLAMP(p_index, -arr_size, arr_size - 1);
+ if (fixed_index < 0) {
+ fixed_index = arr_size + fixed_index;
+ }
+ return fixed_index;
}
-#define ARRAY_GET_DEEP(idx, is_deep) is_deep ? get(idx).duplicate(is_deep) : get(idx)
-
Array Array::slice(int p_begin, int p_end, int p_step, bool p_deep) const { // like python, but inclusive on upper bound
- Array new_arr;
-
- if (empty()) // Don't try to slice empty arrays.
- return new_arr;
- p_begin = Array::_fix_slice_index(p_begin, size(), -1); // can't start out of range
- p_end = Array::_fix_slice_index(p_end, size(), 0);
+ Array new_arr;
- int x = p_begin;
- int new_arr_i = 0;
+ ERR_FAIL_COND_V_MSG(p_step == 0, new_arr, "Array slice step size cannot be zero.");
- ERR_FAIL_COND_V(p_step == 0, new_arr);
- if (Array::_clamp_index(p_begin) == Array::_clamp_index(p_end)) { // don't include element twice
- new_arr.resize(1);
- // new_arr[0] = 1;
- new_arr[0] = ARRAY_GET_DEEP(Array::_clamp_index(p_begin), p_deep);
+ if (empty()) // Don't try to slice empty arrays.
return new_arr;
- } else {
- int element_count = ceil((int)MAX(0, (p_end - p_begin) / p_step)) + 1;
- if (element_count == 1) { // delta going in wrong direction to reach end
- new_arr.resize(0);
+ if (p_step > 0) {
+ if (p_begin >= size() || p_end < -size())
+ return new_arr;
+ } else { // p_step < 0
+ if (p_begin < -size() || p_end >= size())
return new_arr;
- }
- new_arr.resize(element_count);
}
- // if going backwards, have to have a different terminating condition
- if (p_step < 0) {
- while (x >= p_end) {
- new_arr[new_arr_i] = ARRAY_GET_DEEP(Array::_clamp_index(x), p_deep);
- x += p_step;
- new_arr_i += 1;
+ int begin = _clamp_slice_index(p_begin);
+ int end = _clamp_slice_index(p_end);
+
+ int new_arr_size = MAX(((end - begin + p_step) / p_step), 0);
+ new_arr.resize(new_arr_size);
+
+ if (p_step > 0) {
+ int dest_idx = 0;
+ for (int idx = begin; idx <= end; idx += p_step) {
+ ERR_FAIL_COND_V_MSG(dest_idx < 0 || dest_idx >= new_arr_size, Array(), "Bug in Array slice()");
+ new_arr[dest_idx++] = p_deep ? get(idx).duplicate(p_deep) : get(idx);
}
- } else if (p_step > 0) {
- while (x <= p_end) {
- new_arr[new_arr_i] = ARRAY_GET_DEEP(Array::_clamp_index(x), p_deep);
- x += p_step;
- new_arr_i += 1;
+ } else { // p_step < 0
+ int dest_idx = 0;
+ for (int idx = begin; idx >= end; idx += p_step) {
+ ERR_FAIL_COND_V_MSG(dest_idx < 0 || dest_idx >= new_arr_size, Array(), "Bug in Array slice()");
+ new_arr[dest_idx++] = p_deep ? get(idx).duplicate(p_deep) : get(idx);
}
}
diff --git a/core/array.h b/core/array.h
index 2840ce199c..14db57f15f 100644
--- a/core/array.h
+++ b/core/array.h
@@ -44,8 +44,7 @@ class Array {
void _ref(const Array &p_from) const;
void _unref() const;
- int _clamp_index(int p_index) const;
- static int _fix_slice_index(int p_index, int p_arr_len, int p_top_mod);
+ inline int _clamp_slice_index(int p_index) const;
protected:
Array(const Array &p_base, uint32_t p_type, const StringName &p_class_name, const Variant &p_script);
diff --git a/core/debugger/remote_debugger.cpp b/core/debugger/remote_debugger.cpp
index fd109c62b6..97d5c71b6f 100644
--- a/core/debugger/remote_debugger.cpp
+++ b/core/debugger/remote_debugger.cpp
@@ -466,7 +466,7 @@ void RemoteDebugger::_print_handler(void *p_this, const String &p_string, bool p
String s = p_string;
int allowed_chars = MIN(MAX(rd->max_chars_per_second - rd->char_count, 0), s.length());
- if (allowed_chars == 0)
+ if (allowed_chars == 0 && s.length() > 0)
return;
if (allowed_chars < s.length()) {
@@ -480,10 +480,16 @@ void RemoteDebugger::_print_handler(void *p_this, const String &p_string, bool p
if (rd->is_peer_connected()) {
if (overflowed)
s += "[...]";
- rd->output_strings.push_back(s);
+
+ OutputString output_string;
+ output_string.message = s;
+ output_string.type = p_error ? MESSAGE_TYPE_ERROR : MESSAGE_TYPE_LOG;
+ rd->output_strings.push_back(output_string);
if (overflowed) {
- rd->output_strings.push_back("[output overflow, print less text!]");
+ output_string.message = "[output overflow, print less text!]";
+ output_string.type = MESSAGE_TYPE_ERROR;
+ rd->output_strings.push_back(output_string);
}
}
}
@@ -517,15 +523,32 @@ void RemoteDebugger::flush_output() {
if (output_strings.size()) {
// Join output strings so we generate less messages.
+ Vector<String> joined_log_strings;
Vector<String> strings;
- strings.resize(output_strings.size());
- String *w = strings.ptrw();
+ Vector<int> types;
for (int i = 0; i < output_strings.size(); i++) {
- w[i] = output_strings[i];
+ const OutputString &output_string = output_strings[i];
+ if (output_string.type == MESSAGE_TYPE_ERROR) {
+ if (!joined_log_strings.empty()) {
+ strings.push_back(String("\n").join(joined_log_strings));
+ types.push_back(MESSAGE_TYPE_LOG);
+ joined_log_strings.clear();
+ }
+ strings.push_back(output_string.message);
+ types.push_back(MESSAGE_TYPE_ERROR);
+ } else {
+ joined_log_strings.push_back(output_string.message);
+ }
+ }
+
+ if (!joined_log_strings.empty()) {
+ strings.push_back(String("\n").join(joined_log_strings));
+ types.push_back(MESSAGE_TYPE_LOG);
}
Array arr;
arr.push_back(strings);
+ arr.push_back(types);
_put_msg("output", arr);
output_strings.clear();
}
diff --git a/core/debugger/remote_debugger.h b/core/debugger/remote_debugger.h
index f805eec631..cac0bc3730 100644
--- a/core/debugger/remote_debugger.h
+++ b/core/debugger/remote_debugger.h
@@ -40,6 +40,11 @@
#include "core/ustring.h"
class RemoteDebugger : public EngineDebugger {
+public:
+ enum MessageType {
+ MESSAGE_TYPE_LOG,
+ MESSAGE_TYPE_ERROR,
+ };
private:
typedef DebuggerMarshalls::OutputError ErrorMessage;
@@ -57,7 +62,11 @@ private:
Ref<RemoteDebuggerPeer> peer;
- List<String> output_strings;
+ struct OutputString {
+ String message;
+ MessageType type;
+ };
+ List<OutputString> output_strings;
List<ErrorMessage> errors;
int n_messages_dropped = 0;
diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp
index d18adb1983..4b8c104f39 100644
--- a/core/input/input_event.cpp
+++ b/core/input/input_event.cpp
@@ -708,7 +708,7 @@ String InputEventMouseMotion::as_text() const {
button_mask_string = itos(get_button_mask());
break;
}
- return "InputEventMouseMotion : button_mask=" + button_mask_string + ", position=(" + String(get_position()) + "), relative=(" + String(get_relative()) + "), speed=(" + String(get_speed()) + ")";
+ return "InputEventMouseMotion : button_mask=" + button_mask_string + ", position=(" + String(get_position()) + "), relative=(" + String(get_relative()) + "), speed=(" + String(get_speed()) + "), pressure=(" + rtos(get_pressure()) + "), tilt=(" + String(get_tilt()) + ")";
}
bool InputEventMouseMotion::accumulate(const Ref<InputEvent> &p_event) {
diff --git a/core/io/logger.cpp b/core/io/logger.cpp
index 48aebeda3d..ad0cc81023 100644
--- a/core/io/logger.cpp
+++ b/core/io/logger.cpp
@@ -34,17 +34,6 @@
#include "core/os/os.h"
#include "core/print_string.h"
-// va_copy was defined in the C99, but not in C++ standards before C++11.
-// When you compile C++ without --std=c++<XX> option, compilers still define
-// va_copy, otherwise you have to use the internal version (__va_copy).
-#if !defined(va_copy)
-#if defined(__GNUC__)
-#define va_copy(d, s) __va_copy((d), (s))
-#else
-#define va_copy(d, s) ((d) = (s))
-#endif
-#endif
-
#if defined(MINGW_ENABLED) || defined(_MSC_VER)
#define sprintf sprintf_s
#endif
diff --git a/core/math/aabb.h b/core/math/aabb.h
index eca74e6755..7fdad07c89 100644
--- a/core/math/aabb.h
+++ b/core/math/aabb.h
@@ -76,7 +76,7 @@ public:
bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip = nullptr, Vector3 *r_normal = nullptr) const;
_FORCE_INLINE_ bool smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t t0, real_t t1) const;
- _FORCE_INLINE_ bool intersects_convex_shape(const Plane *p_planes, int p_plane_count) const;
+ _FORCE_INLINE_ bool intersects_convex_shape(const Plane *p_planes, int p_plane_count, const Vector3 *p_points, int p_point_count) const;
_FORCE_INLINE_ bool inside_convex_shape(const Plane *p_planes, int p_plane_count) const;
bool intersects_plane(const Plane &p_plane) const;
@@ -190,7 +190,7 @@ Vector3 AABB::get_endpoint(int p_point) const {
ERR_FAIL_V(Vector3());
}
-bool AABB::intersects_convex_shape(const Plane *p_planes, int p_plane_count) const {
+bool AABB::intersects_convex_shape(const Plane *p_planes, int p_plane_count, const Vector3 *p_points, int p_point_count) const {
Vector3 half_extents = size * 0.5;
Vector3 ofs = position + half_extents;
@@ -206,6 +206,30 @@ bool AABB::intersects_convex_shape(const Plane *p_planes, int p_plane_count) con
return false;
}
+ // Make sure all points in the shape aren't fully separated from the AABB on
+ // each axis.
+ int bad_point_counts_positive[3] = { 0 };
+ int bad_point_counts_negative[3] = { 0 };
+
+ for (int k = 0; k < 3; k++) {
+
+ for (int i = 0; i < p_point_count; i++) {
+ if (p_points[i].coord[k] > ofs.coord[k] + half_extents.coord[k]) {
+ bad_point_counts_positive[k]++;
+ }
+ if (p_points[i].coord[k] < ofs.coord[k] - half_extents.coord[k]) {
+ bad_point_counts_negative[k]++;
+ }
+ }
+
+ if (bad_point_counts_negative[k] == p_point_count) {
+ return false;
+ }
+ if (bad_point_counts_positive[k] == p_point_count) {
+ return false;
+ }
+ }
+
return true;
}
diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp
index 4733c27cbc..fa96fc4535 100644
--- a/core/math/geometry.cpp
+++ b/core/math/geometry.cpp
@@ -1178,3 +1178,42 @@ Vector<Vector<Point2>> Geometry::_polypath_offset(const Vector<Point2> &p_polypa
}
return polypaths;
}
+
+Vector<Vector3> Geometry::compute_convex_mesh_points(const Plane *p_planes, int p_plane_count) {
+
+ Vector<Vector3> points;
+
+ // Iterate through every unique combination of any three planes.
+ for (int i = p_plane_count - 1; i >= 0; i--) {
+ for (int j = i - 1; j >= 0; j--) {
+ for (int k = j - 1; k >= 0; k--) {
+
+ // Find the point where these planes all cross over (if they
+ // do at all).
+ Vector3 convex_shape_point;
+ if (p_planes[i].intersect_3(p_planes[j], p_planes[k], &convex_shape_point)) {
+
+ // See if any *other* plane excludes this point because it's
+ // on the wrong side.
+ bool excluded = false;
+ for (int n = 0; n < p_plane_count; n++) {
+ if (n != i && n != j && n != k) {
+ real_t dp = p_planes[n].normal.dot(convex_shape_point);
+ if (dp - p_planes[n].d > CMP_EPSILON) {
+ excluded = true;
+ break;
+ }
+ }
+ }
+
+ // Only add the point if it passed all tests.
+ if (!excluded) {
+ points.push_back(convex_shape_point);
+ }
+ }
+ }
+ }
+ }
+
+ return points;
+}
diff --git a/core/math/geometry.h b/core/math/geometry.h
index a86db6e395..ea063a8a59 100644
--- a/core/math/geometry.h
+++ b/core/math/geometry.h
@@ -1014,6 +1014,8 @@ public:
static void make_atlas(const Vector<Size2i> &p_rects, Vector<Point2i> &r_result, Size2i &r_size);
+ static Vector<Vector3> compute_convex_mesh_points(const Plane *p_planes, int p_plane_count);
+
private:
static Vector<Vector<Point2>> _polypaths_do_operation(PolyBooleanOperation p_op, const Vector<Point2> &p_polypath_a, const Vector<Point2> &p_polypath_b, bool is_a_open = false);
static Vector<Vector<Point2>> _polypath_offset(const Vector<Point2> &p_polypath, real_t p_delta, PolyJoinType p_join_type, PolyEndType p_end_type);
diff --git a/core/math/octree.h b/core/math/octree.h
index 5225fbecb4..ffb405bd0f 100644
--- a/core/math/octree.h
+++ b/core/math/octree.h
@@ -34,6 +34,7 @@
#include "core/list.h"
#include "core/map.h"
#include "core/math/aabb.h"
+#include "core/math/geometry.h"
#include "core/math/vector3.h"
#include "core/print_string.h"
#include "core/variant.h"
@@ -341,6 +342,8 @@ private:
const Plane *planes;
int plane_count;
+ const Vector3 *points;
+ int point_count;
T **result_array;
int *result_idx;
int result_max;
@@ -1017,8 +1020,7 @@ void Octree<T, use_pairs, AL>::_cull_convex(Octant *p_octant, _CullConvexData *p
continue;
e->last_pass = pass;
- if (e->aabb.intersects_convex_shape(p_cull->planes, p_cull->plane_count)) {
-
+ if (e->aabb.intersects_convex_shape(p_cull->planes, p_cull->plane_count, p_cull->points, p_cull->point_count)) {
if (*p_cull->result_idx < p_cull->result_max) {
p_cull->result_array[*p_cull->result_idx] = e->userdata;
(*p_cull->result_idx)++;
@@ -1043,7 +1045,7 @@ void Octree<T, use_pairs, AL>::_cull_convex(Octant *p_octant, _CullConvexData *p
continue;
e->last_pass = pass;
- if (e->aabb.intersects_convex_shape(p_cull->planes, p_cull->plane_count)) {
+ if (e->aabb.intersects_convex_shape(p_cull->planes, p_cull->plane_count, p_cull->points, p_cull->point_count)) {
if (*p_cull->result_idx < p_cull->result_max) {
@@ -1059,7 +1061,7 @@ void Octree<T, use_pairs, AL>::_cull_convex(Octant *p_octant, _CullConvexData *p
for (int i = 0; i < 8; i++) {
- if (p_octant->children[i] && p_octant->children[i]->aabb.intersects_convex_shape(p_cull->planes, p_cull->plane_count)) {
+ if (p_octant->children[i] && p_octant->children[i]->aabb.intersects_convex_shape(p_cull->planes, p_cull->plane_count, p_cull->points, p_cull->point_count)) {
_cull_convex(p_octant->children[i], p_cull);
}
}
@@ -1288,7 +1290,11 @@ void Octree<T, use_pairs, AL>::_cull_point(Octant *p_octant, const Vector3 &p_po
template <class T, bool use_pairs, class AL>
int Octree<T, use_pairs, AL>::cull_convex(const Vector<Plane> &p_convex, T **p_result_array, int p_result_max, uint32_t p_mask) {
- if (!root)
+ if (!root || p_convex.size() == 0)
+ return 0;
+
+ Vector<Vector3> convex_points = Geometry::compute_convex_mesh_points(&p_convex[0], p_convex.size());
+ if (convex_points.size() == 0)
return 0;
int result_count = 0;
@@ -1296,6 +1302,8 @@ int Octree<T, use_pairs, AL>::cull_convex(const Vector<Plane> &p_convex, T **p_r
_CullConvexData cdata;
cdata.planes = &p_convex[0];
cdata.plane_count = p_convex.size();
+ cdata.points = &convex_points[0];
+ cdata.point_count = convex_points.size();
cdata.result_array = p_result_array;
cdata.result_max = p_result_max;
cdata.result_idx = &result_count;
diff --git a/core/math/transform_2d.cpp b/core/math/transform_2d.cpp
index 97a9216a5a..ed95baa233 100644
--- a/core/math/transform_2d.cpp
+++ b/core/math/transform_2d.cpp
@@ -70,6 +70,18 @@ void Transform2D::rotate(real_t p_phi) {
*this = Transform2D(p_phi, Vector2()) * (*this);
}
+real_t Transform2D::get_skew() const {
+
+ real_t det = basis_determinant();
+ return Math::acos(elements[0].normalized().dot(SGN(det) * elements[1].normalized())) - Math_PI * 0.5;
+}
+
+void Transform2D::set_skew(float p_angle) {
+
+ real_t det = basis_determinant();
+ elements[1] = SGN(det) * elements[0].rotated((Math_PI * 0.5 + p_angle)).normalized() * elements[1].length();
+}
+
real_t Transform2D::get_rotation() const {
real_t det = basis_determinant();
Transform2D m = orthonormalized();
diff --git a/core/math/transform_2d.h b/core/math/transform_2d.h
index fa43762aa4..459ceed7a9 100644
--- a/core/math/transform_2d.h
+++ b/core/math/transform_2d.h
@@ -70,7 +70,10 @@ struct Transform2D {
void set_rotation(real_t p_rot);
real_t get_rotation() const;
+ real_t get_skew() const;
+ void set_skew(float p_angle);
_FORCE_INLINE_ void set_rotation_and_scale(real_t p_rot, const Size2 &p_scale);
+ _FORCE_INLINE_ void set_rotation_scale_and_skew(real_t p_rot, const Size2 &p_scale, float p_skew);
void rotate(real_t p_phi);
void scale(const Size2 &p_scale);
@@ -184,6 +187,14 @@ void Transform2D::set_rotation_and_scale(real_t p_rot, const Size2 &p_scale) {
elements[0][1] = Math::sin(p_rot) * p_scale.x;
}
+void Transform2D::set_rotation_scale_and_skew(real_t p_rot, const Size2 &p_scale, float p_skew) {
+
+ elements[0][0] = Math::cos(p_rot) * p_scale.x;
+ elements[1][1] = Math::cos(p_rot + p_skew) * p_scale.y;
+ elements[1][0] = -Math::sin(p_rot + p_skew) * p_scale.y;
+ elements[0][1] = Math::sin(p_rot) * p_scale.x;
+}
+
Rect2 Transform2D::xform_inv(const Rect2 &p_rect) const {
Vector2 ends[4] = {
diff --git a/core/math/triangle_mesh.cpp b/core/math/triangle_mesh.cpp
index 01d38cf24e..5c66721b9d 100644
--- a/core/math/triangle_mesh.cpp
+++ b/core/math/triangle_mesh.cpp
@@ -502,7 +502,7 @@ bool TriangleMesh::intersect_ray(const Vector3 &p_begin, const Vector3 &p_dir, V
return inters;
}
-bool TriangleMesh::intersect_convex_shape(const Plane *p_planes, int p_plane_count) const {
+bool TriangleMesh::intersect_convex_shape(const Plane *p_planes, int p_plane_count, const Vector3 *p_points, int p_point_count) const {
uint32_t *stack = (uint32_t *)alloca(sizeof(int) * max_depth);
//p_fully_inside = true;
@@ -536,7 +536,7 @@ bool TriangleMesh::intersect_convex_shape(const Plane *p_planes, int p_plane_cou
switch (stack[level] >> VISITED_BIT_SHIFT) {
case TEST_AABB_BIT: {
- bool valid = b.aabb.intersects_convex_shape(p_planes, p_plane_count);
+ bool valid = b.aabb.intersects_convex_shape(p_planes, p_plane_count, p_points, p_point_count);
if (!valid) {
stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node;
@@ -617,7 +617,7 @@ bool TriangleMesh::intersect_convex_shape(const Plane *p_planes, int p_plane_cou
return false;
}
-bool TriangleMesh::inside_convex_shape(const Plane *p_planes, int p_plane_count, Vector3 p_scale) const {
+bool TriangleMesh::inside_convex_shape(const Plane *p_planes, int p_plane_count, const Vector3 *p_points, int p_point_count, Vector3 p_scale) const {
uint32_t *stack = (uint32_t *)alloca(sizeof(int) * max_depth);
enum {
@@ -651,7 +651,7 @@ bool TriangleMesh::inside_convex_shape(const Plane *p_planes, int p_plane_count,
switch (stack[level] >> VISITED_BIT_SHIFT) {
case TEST_AABB_BIT: {
- bool intersects = scale.xform(b.aabb).intersects_convex_shape(p_planes, p_plane_count);
+ bool intersects = scale.xform(b.aabb).intersects_convex_shape(p_planes, p_plane_count, p_points, p_point_count);
if (!intersects) return false;
bool inside = scale.xform(b.aabb).inside_convex_shape(p_planes, p_plane_count);
diff --git a/core/math/triangle_mesh.h b/core/math/triangle_mesh.h
index fdbfb90465..64704477cc 100644
--- a/core/math/triangle_mesh.h
+++ b/core/math/triangle_mesh.h
@@ -90,8 +90,8 @@ public:
bool is_valid() const;
bool intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_point, Vector3 &r_normal) const;
bool intersect_ray(const Vector3 &p_begin, const Vector3 &p_dir, Vector3 &r_point, Vector3 &r_normal) const;
- bool intersect_convex_shape(const Plane *p_planes, int p_plane_count) const;
- bool inside_convex_shape(const Plane *p_planes, int p_plane_count, Vector3 p_scale = Vector3(1, 1, 1)) const;
+ bool intersect_convex_shape(const Plane *p_planes, int p_plane_count, const Vector3 *p_points, int p_point_count) const;
+ bool inside_convex_shape(const Plane *p_planes, int p_plane_count, const Vector3 *p_points, int p_point_count, Vector3 p_scale = Vector3(1, 1, 1)) const;
Vector3 get_area_normal(const AABB &p_aabb) const;
Vector<Face3> get_faces() const;
diff --git a/core/os/os.h b/core/os/os.h
index 714a10bf76..38114e6814 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -59,6 +59,7 @@ class OS {
bool _allow_layered;
bool _use_vsync;
bool _vsync_via_compositor;
+ bool _disable_wintab;
char *last_error;
@@ -148,6 +149,7 @@ public:
bool is_layered_allowed() const { return _allow_layered; }
bool is_hidpi_allowed() const { return _allow_hidpi; }
+ bool is_wintab_disabled() const { return _disable_wintab; }
void ensure_user_data_dir();
diff --git a/core/project_settings.cpp b/core/project_settings.cpp
index 63b52661b4..8829181489 100644
--- a/core/project_settings.cpp
+++ b/core/project_settings.cpp
@@ -362,40 +362,29 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
// We need to test both possibilities as extensions for Linux binaries are optional
// (so both 'mygame.bin' and 'mygame' should be able to find 'mygame.pck').
- bool found = false;
-
String exec_dir = exec_path.get_base_dir();
String exec_filename = exec_path.get_file();
String exec_basename = exec_filename.get_basename();
- // Try to load data pack at the location of the executable
- // As mentioned above, we have two potential names to attempt
-
- if (_load_resource_pack(exec_dir.plus_file(exec_basename + ".pck")) ||
- _load_resource_pack(exec_dir.plus_file(exec_filename + ".pck"))) {
- found = true;
- } else {
- // If we couldn't find them next to the executable, we attempt
- // the current working directory. Same story, two tests.
- if (_load_resource_pack(exec_basename + ".pck") ||
- _load_resource_pack(exec_filename + ".pck")) {
- found = true;
- }
- }
+ // Attempt with PCK bundled into executable
+ bool found = _load_resource_pack(exec_path);
#ifdef OSX_ENABLED
- // Attempt to load PCK from macOS .app bundle resources
if (!found) {
- if (_load_resource_pack(OS::get_singleton()->get_bundle_resource_dir().plus_file(exec_basename + ".pck"))) {
- found = true;
- }
+ // Attempt to load PCK from macOS .app bundle resources
+ found = _load_resource_pack(OS::get_singleton()->get_bundle_resource_dir().plus_file(exec_basename + ".pck"));
}
#endif
- // Attempt with PCK bundled into executable
if (!found) {
- if (_load_resource_pack(exec_path)) {
- found = true;
+ // Try to load data pack at the location of the executable
+ // As mentioned above, we have two potential names to attempt
+ found = _load_resource_pack(exec_dir.plus_file(exec_basename + ".pck")) || _load_resource_pack(exec_dir.plus_file(exec_filename + ".pck"));
+
+ if (!found) {
+ // If we couldn't find them next to the executable, we attempt
+ // the current working directory. Same story, two tests.
+ found = _load_resource_pack(exec_basename + ".pck") || _load_resource_pack(exec_filename + ".pck");
}
}
diff --git a/core/variant.h b/core/variant.h
index a832f7ccf8..1ae09ad82f 100644
--- a/core/variant.h
+++ b/core/variant.h
@@ -67,13 +67,6 @@ typedef Vector<Vector2> PackedVector2Array;
typedef Vector<Vector3> PackedVector3Array;
typedef Vector<Color> PackedColorArray;
-// Temporary workaround until c++11 alignas()
-#ifdef __GNUC__
-#define GCC_ALIGNED_8 __attribute__((aligned(8)))
-#else
-#define GCC_ALIGNED_8
-#endif
-
class Variant {
public:
// If this changes the table in variant_op must be updated
@@ -211,7 +204,7 @@ private:
PackedArrayRefBase *packed_array;
void *_ptr; //generic pointer
uint8_t _mem[sizeof(ObjData) > (sizeof(real_t) * 4) ? sizeof(ObjData) : (sizeof(real_t) * 4)];
- } _data GCC_ALIGNED_8;
+ } _data alignas(8);
void reference(const Variant &p_variant);
void clear();
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 395e46d912..9fffb42ff6 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -1358,6 +1358,8 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i
case RECT2I: return (Rect2i(*p_args[0]));
case VECTOR3: return (Vector3(*p_args[0]));
case VECTOR3I: return (Vector3i(*p_args[0]));
+ case TRANSFORM2D:
+ return (Transform2D(p_args[0]->operator Transform2D()));
case PLANE: return (Plane(*p_args[0]));
case QUAT: return (p_args[0]->operator Quat());
case AABB: