Cleanup unused engine code v2
This commit is contained in:
parent
cd0a9ccdfd
commit
c0083e431b
|
@ -1069,23 +1069,6 @@ Variant _GLOBAL_DEF(const PropertyInfo &p_info, const Variant &p_default, bool p
|
|||
return ret;
|
||||
}
|
||||
|
||||
Vector<String> ProjectSettings::get_optimizer_presets() const {
|
||||
List<PropertyInfo> pi;
|
||||
ProjectSettings::get_singleton()->get_property_list(&pi);
|
||||
Vector<String> names;
|
||||
|
||||
for (const PropertyInfo &E : pi) {
|
||||
if (!E.name.begins_with("optimizer_presets/")) {
|
||||
continue;
|
||||
}
|
||||
names.push_back(E.name.get_slicec('/', 1));
|
||||
}
|
||||
|
||||
names.sort();
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
void ProjectSettings::_add_property_info_bind(const Dictionary &p_info) {
|
||||
ERR_FAIL_COND(!p_info.has("name"));
|
||||
ERR_FAIL_COND(!p_info.has("type"));
|
||||
|
|
|
@ -178,8 +178,6 @@ public:
|
|||
const HashMap<StringName, PropertyInfo> &get_custom_property_info() const;
|
||||
uint64_t get_last_saved_time() { return last_save_time; }
|
||||
|
||||
Vector<String> get_optimizer_presets() const;
|
||||
|
||||
List<String> get_input_presets() const { return input_presets; }
|
||||
|
||||
Variant get_setting_with_override(const StringName &p_name) const;
|
||||
|
|
|
@ -73,10 +73,6 @@ bool ScriptDebugger::is_breakpoint(int p_line, const StringName &p_source) const
|
|||
return breakpoints[p_line].has(p_source);
|
||||
}
|
||||
|
||||
bool ScriptDebugger::is_breakpoint_line(int p_line) const {
|
||||
return breakpoints.has(p_line);
|
||||
}
|
||||
|
||||
String ScriptDebugger::breakpoint_find_source(const String &p_source) const {
|
||||
return p_source;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,6 @@ public:
|
|||
void insert_breakpoint(int p_line, const StringName &p_source);
|
||||
void remove_breakpoint(int p_line, const StringName &p_source);
|
||||
bool is_breakpoint(int p_line, const StringName &p_source) const;
|
||||
bool is_breakpoint_line(int p_line) const;
|
||||
void clear_breakpoints();
|
||||
const HashMap<int, HashSet<StringName>> &get_breakpoints() const { return breakpoints; }
|
||||
|
||||
|
|
|
@ -135,10 +135,6 @@ void ImageLoader::remove_image_format_loader(Ref<ImageFormatLoader> p_loader) {
|
|||
loader.erase(p_loader);
|
||||
}
|
||||
|
||||
const Vector<Ref<ImageFormatLoader>> &ImageLoader::get_image_format_loaders() {
|
||||
return loader;
|
||||
}
|
||||
|
||||
void ImageLoader::cleanup() {
|
||||
while (loader.size()) {
|
||||
remove_image_format_loader(loader[0]);
|
||||
|
|
|
@ -98,8 +98,6 @@ public:
|
|||
static void add_image_format_loader(Ref<ImageFormatLoader> p_loader);
|
||||
static void remove_image_format_loader(Ref<ImageFormatLoader> p_loader);
|
||||
|
||||
static const Vector<Ref<ImageFormatLoader>> &get_image_format_loaders();
|
||||
|
||||
static void cleanup();
|
||||
};
|
||||
|
||||
|
|
|
@ -385,10 +385,6 @@ void Resource::set_as_translation_remapped(bool p_remapped) {
|
|||
ResourceCache::lock.unlock();
|
||||
}
|
||||
|
||||
bool Resource::is_translation_remapped() const {
|
||||
return remapped_list.in_list();
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
//helps keep IDs same number when loading/saving scenes. -1 clears ID and it Returns -1 when no id stored
|
||||
void Resource::set_id_for_path(const String &p_path, const String &p_id) {
|
||||
|
@ -481,9 +477,6 @@ void ResourceCache::clear() {
|
|||
resources.clear();
|
||||
}
|
||||
|
||||
void ResourceCache::reload_externals() {
|
||||
}
|
||||
|
||||
bool ResourceCache::has(const String &p_path) {
|
||||
lock.lock();
|
||||
|
||||
|
|
|
@ -136,7 +136,6 @@ public:
|
|||
#endif
|
||||
|
||||
void set_as_translation_remapped(bool p_remapped);
|
||||
bool is_translation_remapped() const;
|
||||
|
||||
virtual RID get_rid() const; // some resources may offer conversion to RID
|
||||
|
||||
|
@ -164,7 +163,6 @@ class ResourceCache {
|
|||
friend void register_core_types();
|
||||
|
||||
public:
|
||||
static void reload_externals();
|
||||
static bool has(const String &p_path);
|
||||
static Ref<Resource> get_ref(const String &p_path);
|
||||
static void get_cached_resources(List<Ref<Resource>> *p_resources);
|
||||
|
|
|
@ -661,10 +661,6 @@ Error ResourceLoaderBinary::parse_variant(Variant &r_v) {
|
|||
return OK; //never reach anyway
|
||||
}
|
||||
|
||||
void ResourceLoaderBinary::set_local_path(const String &p_local_path) {
|
||||
res_path = p_local_path;
|
||||
}
|
||||
|
||||
Ref<Resource> ResourceLoaderBinary::get_resource() {
|
||||
return resource;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,6 @@ class ResourceLoaderBinary {
|
|||
HashMap<String, Ref<Resource>> dependency_cache;
|
||||
|
||||
public:
|
||||
void set_local_path(const String &p_local_path);
|
||||
Ref<Resource> get_resource();
|
||||
Error load();
|
||||
void set_translation_remapped(bool p_remapped);
|
||||
|
|
|
@ -1011,13 +1011,6 @@ bool ResourceLoader::add_custom_resource_format_loader(String script_path) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void ResourceLoader::remove_custom_resource_format_loader(String script_path) {
|
||||
Ref<ResourceFormatLoader> custom_loader = _find_custom_resource_format_loader(script_path);
|
||||
if (custom_loader.is_valid()) {
|
||||
remove_resource_format_loader(custom_loader);
|
||||
}
|
||||
}
|
||||
|
||||
void ResourceLoader::set_create_missing_resources_if_class_unavailable(bool p_enable) {
|
||||
create_missing_resources_if_class_unavailable = p_enable;
|
||||
}
|
||||
|
|
|
@ -225,7 +225,6 @@ public:
|
|||
static ResourceLoaderImport import;
|
||||
|
||||
static bool add_custom_resource_format_loader(String script_path);
|
||||
static void remove_custom_resource_format_loader(String script_path);
|
||||
static void add_custom_loaders();
|
||||
static void remove_custom_loaders();
|
||||
|
||||
|
|
|
@ -250,13 +250,6 @@ bool ResourceSaver::add_custom_resource_format_saver(String script_path) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void ResourceSaver::remove_custom_resource_format_saver(String script_path) {
|
||||
Ref<ResourceFormatSaver> custom_saver = _find_custom_resource_format_saver(script_path);
|
||||
if (custom_saver.is_valid()) {
|
||||
remove_resource_format_saver(custom_saver);
|
||||
}
|
||||
}
|
||||
|
||||
void ResourceSaver::add_custom_savers() {
|
||||
// Custom resource savers exploits global class names
|
||||
|
||||
|
|
|
@ -101,7 +101,6 @@ public:
|
|||
static void set_get_resource_id_for_path(ResourceSaverGetResourceIDForPath p_callback);
|
||||
|
||||
static bool add_custom_resource_format_saver(String script_path);
|
||||
static void remove_custom_resource_format_saver(String script_path);
|
||||
static void add_custom_savers();
|
||||
static void remove_custom_savers();
|
||||
};
|
||||
|
|
|
@ -36,23 +36,6 @@
|
|||
#define cofac(row1, col1, row2, col2) \
|
||||
(rows[row1][col1] * rows[row2][col2] - rows[row1][col2] * rows[row2][col1])
|
||||
|
||||
void Basis::from_z(const Vector3 &p_z) {
|
||||
if (Math::abs(p_z.z) > (real_t)Math_SQRT12) {
|
||||
// choose p in y-z plane
|
||||
real_t a = p_z[1] * p_z[1] + p_z[2] * p_z[2];
|
||||
real_t k = 1.0f / Math::sqrt(a);
|
||||
rows[0] = Vector3(0, -p_z[2] * k, p_z[1] * k);
|
||||
rows[1] = Vector3(a * k, -p_z[0] * rows[0][2], p_z[0] * rows[0][1]);
|
||||
} else {
|
||||
// choose p in x-y plane
|
||||
real_t a = p_z.x * p_z.x + p_z.y * p_z.y;
|
||||
real_t k = 1.0f / Math::sqrt(a);
|
||||
rows[0] = Vector3(-p_z.y * k, p_z.x * k, 0);
|
||||
rows[1] = Vector3(-p_z.z * rows[0].y, p_z.z * rows[0].x, a * k);
|
||||
}
|
||||
rows[2] = p_z;
|
||||
}
|
||||
|
||||
void Basis::invert() {
|
||||
real_t co[3] = {
|
||||
cofac(1, 1, 2, 2), cofac(1, 2, 2, 0), cofac(1, 0, 2, 1)
|
||||
|
@ -271,14 +254,6 @@ float Basis::get_uniform_scale() const {
|
|||
return (rows[0].length() + rows[1].length() + rows[2].length()) / 3.0f;
|
||||
}
|
||||
|
||||
void Basis::make_scale_uniform() {
|
||||
float l = (rows[0].length() + rows[1].length() + rows[2].length()) / 3.0f;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
rows[i].normalize();
|
||||
rows[i] *= l;
|
||||
}
|
||||
}
|
||||
|
||||
Basis Basis::scaled_local(const Vector3 &p_scale) const {
|
||||
return (*this) * Basis::from_scale(p_scale);
|
||||
}
|
||||
|
|
|
@ -56,8 +56,6 @@ struct _NO_DISCARD_ Basis {
|
|||
|
||||
_FORCE_INLINE_ real_t determinant() const;
|
||||
|
||||
void from_z(const Vector3 &p_z);
|
||||
|
||||
void rotate(const Vector3 &p_axis, real_t p_angle);
|
||||
Basis rotated(const Vector3 &p_axis, real_t p_angle) const;
|
||||
|
||||
|
@ -101,8 +99,6 @@ struct _NO_DISCARD_ Basis {
|
|||
|
||||
void scale_orthogonal(const Vector3 &p_scale);
|
||||
Basis scaled_orthogonal(const Vector3 &p_scale) const;
|
||||
|
||||
void make_scale_uniform();
|
||||
float get_uniform_scale() const;
|
||||
|
||||
Vector3 get_scale() const;
|
||||
|
|
|
@ -120,36 +120,6 @@ bool Face3::is_degenerate() const {
|
|||
return (normal.length_squared() < (real_t)CMP_EPSILON2);
|
||||
}
|
||||
|
||||
Face3::Side Face3::get_side_of(const Face3 &p_face, ClockDirection p_clock_dir) const {
|
||||
int over = 0, under = 0;
|
||||
|
||||
Plane plane = get_plane(p_clock_dir);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
const Vector3 &v = p_face.vertex[i];
|
||||
|
||||
if (plane.has_point(v)) { //coplanar, don't bother
|
||||
continue;
|
||||
}
|
||||
|
||||
if (plane.is_point_over(v)) {
|
||||
over++;
|
||||
} else {
|
||||
under++;
|
||||
}
|
||||
}
|
||||
|
||||
if (over > 0 && under == 0) {
|
||||
return SIDE_OVER;
|
||||
} else if (under > 0 && over == 0) {
|
||||
return SIDE_UNDER;
|
||||
} else if (under == 0 && over == 0) {
|
||||
return SIDE_COPLANAR;
|
||||
} else {
|
||||
return SIDE_SPANNING;
|
||||
}
|
||||
}
|
||||
|
||||
Vector3 Face3::get_random_point_inside() const {
|
||||
real_t a = Math::random(0.0, 1.0);
|
||||
real_t b = Math::random(0.0, 1.0);
|
||||
|
@ -164,20 +134,10 @@ Plane Face3::get_plane(ClockDirection p_dir) const {
|
|||
return Plane(vertex[0], vertex[1], vertex[2], p_dir);
|
||||
}
|
||||
|
||||
Vector3 Face3::get_median_point() const {
|
||||
return (vertex[0] + vertex[1] + vertex[2]) / 3.0f;
|
||||
}
|
||||
|
||||
real_t Face3::get_area() const {
|
||||
return vec3_cross(vertex[0] - vertex[1], vertex[0] - vertex[2]).length() * 0.5f;
|
||||
}
|
||||
|
||||
ClockDirection Face3::get_clock_dir() const {
|
||||
Vector3 normal = vec3_cross(vertex[0] - vertex[1], vertex[0] - vertex[2]);
|
||||
//printf("normal is %g,%g,%g x %g,%g,%g- wtfu is %g\n",tofloat(normal.x),tofloat(normal.y),tofloat(normal.z),tofloat(vertex[0].x),tofloat(vertex[0].y),tofloat(vertex[0].z),tofloat( normal.dot( vertex[0] ) ) );
|
||||
return (normal.dot(vertex[0]) >= 0) ? CLOCKWISE : COUNTERCLOCKWISE;
|
||||
}
|
||||
|
||||
bool Face3::intersects_aabb(const AABB &p_aabb) const {
|
||||
/** TEST PLANE **/
|
||||
if (!p_aabb.intersects_plane(get_plane())) {
|
||||
|
|
|
@ -57,19 +57,14 @@ struct _NO_DISCARD_ Face3 {
|
|||
Plane get_plane(ClockDirection p_dir = CLOCKWISE) const;
|
||||
Vector3 get_random_point_inside() const;
|
||||
|
||||
Side get_side_of(const Face3 &p_face, ClockDirection p_clock_dir = CLOCKWISE) const;
|
||||
|
||||
bool is_degenerate() const;
|
||||
real_t get_area() const;
|
||||
|
||||
Vector3 get_median_point() const;
|
||||
Vector3 get_closest_point_to(const Vector3 &p_point) const;
|
||||
|
||||
bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection = nullptr) const;
|
||||
bool intersects_segment(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection = nullptr) const;
|
||||
|
||||
ClockDirection get_clock_dir() const; ///< todo, test if this is returning the proper clockwisity
|
||||
|
||||
void get_support(const Vector3 &p_normal, const Transform3D &p_transform, Vector3 *p_vertices, int *p_count, int p_max) const;
|
||||
void project_range(const Vector3 &p_normal, const Transform3D &p_transform, real_t &r_min, real_t &r_max) const;
|
||||
|
||||
|
|
|
@ -320,41 +320,6 @@ Vector<Vector<Point2>> Geometry2D::_polypath_offset(const Vector<Point2> &p_poly
|
|||
return polypaths;
|
||||
}
|
||||
|
||||
Vector<Point2i> Geometry2D::pack_rects(const Vector<Size2i> &p_sizes, const Size2i &p_atlas_size) {
|
||||
Vector<stbrp_node> nodes;
|
||||
nodes.resize(p_atlas_size.width);
|
||||
|
||||
stbrp_context context;
|
||||
stbrp_init_target(&context, p_atlas_size.width, p_atlas_size.height, nodes.ptrw(), p_atlas_size.width);
|
||||
|
||||
Vector<stbrp_rect> rects;
|
||||
rects.resize(p_sizes.size());
|
||||
|
||||
for (int i = 0; i < p_sizes.size(); i++) {
|
||||
rects.write[i].id = 0;
|
||||
rects.write[i].w = p_sizes[i].width;
|
||||
rects.write[i].h = p_sizes[i].height;
|
||||
rects.write[i].x = 0;
|
||||
rects.write[i].y = 0;
|
||||
rects.write[i].was_packed = 0;
|
||||
}
|
||||
|
||||
int res = stbrp_pack_rects(&context, rects.ptrw(), rects.size());
|
||||
if (res == 0) { //pack failed
|
||||
return Vector<Point2i>();
|
||||
}
|
||||
|
||||
Vector<Point2i> ret;
|
||||
ret.resize(p_sizes.size());
|
||||
|
||||
for (int i = 0; i < p_sizes.size(); i++) {
|
||||
Point2i r(rects[i].x, rects[i].y);
|
||||
ret.write[i] = r;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Vector<Vector3i> Geometry2D::partial_pack_rects(const Vector<Vector2i> &p_sizes, const Size2i &p_atlas_size) {
|
||||
Vector<stbrp_node> nodes;
|
||||
nodes.resize(p_atlas_size.width);
|
||||
|
|
|
@ -464,7 +464,6 @@ public:
|
|||
static Vector<Vector<Vector2>> decompose_polygon_in_convex(Vector<Point2> polygon);
|
||||
|
||||
static void make_atlas(const Vector<Size2i> &p_rects, Vector<Point2i> &r_result, Size2i &r_size);
|
||||
static Vector<Point2i> pack_rects(const Vector<Size2i> &p_sizes, const Size2i &p_atlas_size);
|
||||
static Vector<Vector3i> partial_pack_rects(const Vector<Vector2i> &p_sizes, const Size2i &p_atlas_size);
|
||||
|
||||
private:
|
||||
|
|
|
@ -198,149 +198,6 @@ struct _FaceClassify {
|
|||
_FaceClassify() {}
|
||||
};
|
||||
|
||||
static bool _connect_faces(_FaceClassify *p_faces, int len, int p_group) {
|
||||
// Connect faces, error will occur if an edge is shared between more than 2 faces.
|
||||
// Clear connections.
|
||||
|
||||
bool error = false;
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
p_faces[i].links[j].clear();
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (p_faces[i].group != p_group) {
|
||||
continue;
|
||||
}
|
||||
for (int j = i + 1; j < len; j++) {
|
||||
if (p_faces[j].group != p_group) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int k = 0; k < 3; k++) {
|
||||
Vector3 vi1 = p_faces[i].face.vertex[k];
|
||||
Vector3 vi2 = p_faces[i].face.vertex[(k + 1) % 3];
|
||||
|
||||
for (int l = 0; l < 3; l++) {
|
||||
Vector3 vj2 = p_faces[j].face.vertex[l];
|
||||
Vector3 vj1 = p_faces[j].face.vertex[(l + 1) % 3];
|
||||
|
||||
if (vi1.distance_to(vj1) < 0.00001f &&
|
||||
vi2.distance_to(vj2) < 0.00001f) {
|
||||
if (p_faces[i].links[k].face != -1) {
|
||||
ERR_PRINT("already linked\n");
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
if (p_faces[j].links[l].face != -1) {
|
||||
ERR_PRINT("already linked\n");
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
|
||||
p_faces[i].links[k].face = j;
|
||||
p_faces[i].links[k].edge = l;
|
||||
p_faces[j].links[l].face = i;
|
||||
p_faces[j].links[l].edge = k;
|
||||
}
|
||||
}
|
||||
if (error) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (error) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (error) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
p_faces[i].valid = true;
|
||||
for (int j = 0; j < 3; j++) {
|
||||
if (p_faces[i].links[j].face == -1) {
|
||||
p_faces[i].valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
static bool _group_face(_FaceClassify *p_faces, int len, int p_index, int p_group) {
|
||||
if (p_faces[p_index].group >= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
p_faces[p_index].group = p_group;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
ERR_FAIL_INDEX_V(p_faces[p_index].links[i].face, len, true);
|
||||
_group_face(p_faces, len, p_faces[p_index].links[i].face, p_group);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Vector<Vector<Face3>> Geometry3D::separate_objects(Vector<Face3> p_array) {
|
||||
Vector<Vector<Face3>> objects;
|
||||
|
||||
int len = p_array.size();
|
||||
|
||||
const Face3 *arrayptr = p_array.ptr();
|
||||
|
||||
Vector<_FaceClassify> fc;
|
||||
|
||||
fc.resize(len);
|
||||
|
||||
_FaceClassify *_fcptr = fc.ptrw();
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
_fcptr[i].face = arrayptr[i];
|
||||
}
|
||||
|
||||
bool error = _connect_faces(_fcptr, len, -1);
|
||||
|
||||
ERR_FAIL_COND_V_MSG(error, Vector<Vector<Face3>>(), "Invalid geometry.");
|
||||
|
||||
// Group connected faces in separate objects.
|
||||
|
||||
int group = 0;
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (!_fcptr[i].valid) {
|
||||
continue;
|
||||
}
|
||||
if (_group_face(_fcptr, len, i, group)) {
|
||||
group++;
|
||||
}
|
||||
}
|
||||
|
||||
// Group connected faces in separate objects.
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
_fcptr[i].face = arrayptr[i];
|
||||
}
|
||||
|
||||
if (group >= 0) {
|
||||
objects.resize(group);
|
||||
Vector<Face3> *group_faces = objects.ptrw();
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (!_fcptr[i].valid) {
|
||||
continue;
|
||||
}
|
||||
if (_fcptr[i].group >= 0 && _fcptr[i].group < group) {
|
||||
group_faces[_fcptr[i].group].push_back(_fcptr[i].face);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return objects;
|
||||
}
|
||||
|
||||
/*** GEOMETRY WRAPPER ***/
|
||||
|
||||
enum _CellFlags {
|
||||
|
|
|
@ -532,8 +532,6 @@ public:
|
|||
return clipped;
|
||||
}
|
||||
|
||||
static Vector<Vector<Face3>> separate_objects(Vector<Face3> p_array);
|
||||
|
||||
// Create a "wrap" that encloses the given geometry.
|
||||
static Vector<Face3> wrap_geometry(Vector<Face3> p_array, real_t *p_error = nullptr);
|
||||
|
||||
|
|
|
@ -221,12 +221,6 @@ Transform2D Transform2D::operator*(const Transform2D &p_transform) const {
|
|||
return t;
|
||||
}
|
||||
|
||||
Transform2D Transform2D::basis_scaled(const Size2 &p_scale) const {
|
||||
Transform2D copy = *this;
|
||||
copy.scale_basis(p_scale);
|
||||
return copy;
|
||||
}
|
||||
|
||||
Transform2D Transform2D::scaled(const Size2 &p_scale) const {
|
||||
// Equivalent to left multiplication
|
||||
Transform2D copy = *this;
|
||||
|
|
|
@ -85,7 +85,6 @@ struct _NO_DISCARD_ Transform2D {
|
|||
_FORCE_INLINE_ const Vector2 &get_origin() const { return columns[2]; }
|
||||
_FORCE_INLINE_ void set_origin(const Vector2 &p_origin) { columns[2] = p_origin; }
|
||||
|
||||
Transform2D basis_scaled(const Size2 &p_scale) const;
|
||||
Transform2D scaled(const Size2 &p_scale) const;
|
||||
Transform2D scaled_local(const Size2 &p_scale) const;
|
||||
Transform2D translated(const Vector2 &p_offset) const;
|
||||
|
|
|
@ -182,90 +182,6 @@ void TriangleMesh::create(const Vector<Vector3> &p_faces, const Vector<int32_t>
|
|||
valid = true;
|
||||
}
|
||||
|
||||
Vector3 TriangleMesh::get_area_normal(const AABB &p_aabb) const {
|
||||
uint32_t *stack = (uint32_t *)alloca(sizeof(int) * max_depth);
|
||||
|
||||
enum {
|
||||
TEST_AABB_BIT = 0,
|
||||
VISIT_LEFT_BIT = 1,
|
||||
VISIT_RIGHT_BIT = 2,
|
||||
VISIT_DONE_BIT = 3,
|
||||
VISITED_BIT_SHIFT = 29,
|
||||
NODE_IDX_MASK = (1 << VISITED_BIT_SHIFT) - 1,
|
||||
VISITED_BIT_MASK = ~NODE_IDX_MASK,
|
||||
|
||||
};
|
||||
|
||||
int n_count = 0;
|
||||
Vector3 n;
|
||||
|
||||
int level = 0;
|
||||
|
||||
const Triangle *triangleptr = triangles.ptr();
|
||||
// const Vector3 *verticesr = vertices.ptr();
|
||||
const BVH *bvhptr = bvh.ptr();
|
||||
|
||||
int pos = bvh.size() - 1;
|
||||
|
||||
stack[0] = pos;
|
||||
while (true) {
|
||||
uint32_t node = stack[level] & NODE_IDX_MASK;
|
||||
const BVH &b = bvhptr[node];
|
||||
bool done = false;
|
||||
|
||||
switch (stack[level] >> VISITED_BIT_SHIFT) {
|
||||
case TEST_AABB_BIT: {
|
||||
if (!b.aabb.intersects(p_aabb)) {
|
||||
stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node;
|
||||
} else {
|
||||
if (b.face_index >= 0) {
|
||||
const Triangle &s = triangleptr[b.face_index];
|
||||
n += s.normal;
|
||||
n_count++;
|
||||
|
||||
stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node;
|
||||
|
||||
} else {
|
||||
stack[level] = (VISIT_LEFT_BIT << VISITED_BIT_SHIFT) | node;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
case VISIT_LEFT_BIT: {
|
||||
stack[level] = (VISIT_RIGHT_BIT << VISITED_BIT_SHIFT) | node;
|
||||
level++;
|
||||
stack[level] = b.left | TEST_AABB_BIT;
|
||||
continue;
|
||||
}
|
||||
case VISIT_RIGHT_BIT: {
|
||||
stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node;
|
||||
level++;
|
||||
stack[level] = b.right | TEST_AABB_BIT;
|
||||
continue;
|
||||
}
|
||||
case VISIT_DONE_BIT: {
|
||||
if (level == 0) {
|
||||
done = true;
|
||||
break;
|
||||
} else {
|
||||
level--;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (done) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (n_count > 0) {
|
||||
n /= n_count;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
bool TriangleMesh::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_point, Vector3 &r_normal, int32_t *r_surf_index) const {
|
||||
uint32_t *stack = (uint32_t *)alloca(sizeof(int) * max_depth);
|
||||
|
||||
|
@ -468,118 +384,6 @@ 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 Vector3 *p_points, int p_point_count) const {
|
||||
uint32_t *stack = (uint32_t *)alloca(sizeof(int) * max_depth);
|
||||
|
||||
//p_fully_inside = true;
|
||||
|
||||
enum {
|
||||
TEST_AABB_BIT = 0,
|
||||
VISIT_LEFT_BIT = 1,
|
||||
VISIT_RIGHT_BIT = 2,
|
||||
VISIT_DONE_BIT = 3,
|
||||
VISITED_BIT_SHIFT = 29,
|
||||
NODE_IDX_MASK = (1 << VISITED_BIT_SHIFT) - 1,
|
||||
VISITED_BIT_MASK = ~NODE_IDX_MASK,
|
||||
|
||||
};
|
||||
|
||||
int level = 0;
|
||||
|
||||
const Triangle *triangleptr = triangles.ptr();
|
||||
const Vector3 *vertexptr = vertices.ptr();
|
||||
const BVH *bvhptr = bvh.ptr();
|
||||
|
||||
int pos = bvh.size() - 1;
|
||||
|
||||
stack[0] = pos;
|
||||
while (true) {
|
||||
uint32_t node = stack[level] & NODE_IDX_MASK;
|
||||
const BVH &b = bvhptr[node];
|
||||
bool done = false;
|
||||
|
||||
switch (stack[level] >> VISITED_BIT_SHIFT) {
|
||||
case TEST_AABB_BIT: {
|
||||
if (!b.aabb.intersects_convex_shape(p_planes, p_plane_count, p_points, p_point_count)) {
|
||||
stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node;
|
||||
} else {
|
||||
if (b.face_index >= 0) {
|
||||
const Triangle &s = triangleptr[b.face_index];
|
||||
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
const Vector3 &point = vertexptr[s.indices[j]];
|
||||
const Vector3 &next_point = vertexptr[s.indices[(j + 1) % 3]];
|
||||
Vector3 res;
|
||||
bool over = true;
|
||||
for (int i = 0; i < p_plane_count; i++) {
|
||||
const Plane &p = p_planes[i];
|
||||
|
||||
if (p.intersects_segment(point, next_point, &res)) {
|
||||
bool inisde = true;
|
||||
for (int k = 0; k < p_plane_count; k++) {
|
||||
if (k == i) {
|
||||
continue;
|
||||
}
|
||||
const Plane &pp = p_planes[k];
|
||||
if (pp.is_point_over(res)) {
|
||||
inisde = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (inisde) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (p.is_point_over(point)) {
|
||||
over = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (over) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node;
|
||||
|
||||
} else {
|
||||
stack[level] = (VISIT_LEFT_BIT << VISITED_BIT_SHIFT) | node;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
case VISIT_LEFT_BIT: {
|
||||
stack[level] = (VISIT_RIGHT_BIT << VISITED_BIT_SHIFT) | node;
|
||||
level++;
|
||||
stack[level] = b.left | TEST_AABB_BIT;
|
||||
continue;
|
||||
}
|
||||
case VISIT_RIGHT_BIT: {
|
||||
stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node;
|
||||
level++;
|
||||
stack[level] = b.right | TEST_AABB_BIT;
|
||||
continue;
|
||||
}
|
||||
case VISIT_DONE_BIT: {
|
||||
if (level == 0) {
|
||||
done = true;
|
||||
break;
|
||||
} else {
|
||||
level--;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (done) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -84,9 +84,7 @@ public:
|
|||
bool is_valid() const;
|
||||
bool intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_point, Vector3 &r_normal, int32_t *r_surf_index = nullptr) const;
|
||||
bool intersect_ray(const Vector3 &p_begin, const Vector3 &p_dir, Vector3 &r_point, Vector3 &r_normal, int32_t *r_surf_index = nullptr) 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;
|
||||
|
||||
const Vector<Triangle> &get_triangles() const { return triangles; }
|
||||
|
|
|
@ -122,12 +122,6 @@ int EditorSelectionHistory::get_history_pos() {
|
|||
return current_elem_idx;
|
||||
}
|
||||
|
||||
bool EditorSelectionHistory::is_history_obj_inspector_only(int p_obj) const {
|
||||
ERR_FAIL_INDEX_V(p_obj, history.size(), false);
|
||||
ERR_FAIL_INDEX_V(history[p_obj].level, history[p_obj].path.size(), false);
|
||||
return history[p_obj].path[history[p_obj].level].inspector_only;
|
||||
}
|
||||
|
||||
ObjectID EditorSelectionHistory::get_history_obj(int p_obj) const {
|
||||
ERR_FAIL_INDEX_V(p_obj, history.size(), ObjectID());
|
||||
ERR_FAIL_INDEX_V(history[p_obj].level, history[p_obj].path.size(), ObjectID());
|
||||
|
@ -351,18 +345,6 @@ void EditorData::apply_changes_in_editors() {
|
|||
}
|
||||
}
|
||||
|
||||
void EditorData::save_editor_global_states() {
|
||||
for (int i = 0; i < editor_plugins.size(); i++) {
|
||||
editor_plugins[i]->save_global_state();
|
||||
}
|
||||
}
|
||||
|
||||
void EditorData::restore_editor_global_states() {
|
||||
for (int i = 0; i < editor_plugins.size(); i++) {
|
||||
editor_plugins[i]->restore_global_state();
|
||||
}
|
||||
}
|
||||
|
||||
void EditorData::paste_object_params(Object *p_object) {
|
||||
ERR_FAIL_NULL(p_object);
|
||||
undo_redo_manager->create_action(TTR("Paste Params"));
|
||||
|
|
|
@ -80,7 +80,6 @@ public:
|
|||
|
||||
// Gets an object from the history. The most recent object would be the object with p_obj = get_history_len() - 1.
|
||||
ObjectID get_history_obj(int p_obj) const;
|
||||
bool is_history_obj_inspector_only(int p_obj) const;
|
||||
|
||||
bool next();
|
||||
bool previous();
|
||||
|
@ -177,7 +176,6 @@ public:
|
|||
Callable get_move_array_element_function(const StringName &p_class) const;
|
||||
|
||||
void save_editor_global_states();
|
||||
void restore_editor_global_states();
|
||||
|
||||
void add_custom_type(const String &p_type, const String &p_inherits, const Ref<Script> &p_script, const Ref<Texture2D> &p_icon);
|
||||
Variant instantiate_custom_type(const String &p_type, const String &p_inherits);
|
||||
|
|
|
@ -7400,7 +7400,6 @@ EditorNode::EditorNode() {
|
|||
|
||||
_update_recent_scenes();
|
||||
|
||||
editor_data.restore_editor_global_states();
|
||||
set_process_shortcut_input(true);
|
||||
|
||||
load_errors = memnew(RichTextLabel);
|
||||
|
|
|
@ -711,9 +711,6 @@ bool EditorPlugin::get_remove_list(List<Node *> *p_list) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void EditorPlugin::restore_global_state() {}
|
||||
void EditorPlugin::save_global_state() {}
|
||||
|
||||
void EditorPlugin::add_undo_redo_inspector_hook_callback(Callable p_callable) {
|
||||
EditorNode::get_singleton()->get_editor_data().add_undo_redo_inspector_hook_callback(p_callable);
|
||||
}
|
||||
|
|
|
@ -277,9 +277,6 @@ public:
|
|||
void make_bottom_panel_item_visible(Control *p_item);
|
||||
void hide_bottom_panel();
|
||||
|
||||
virtual void restore_global_state();
|
||||
virtual void save_global_state();
|
||||
|
||||
void add_translation_parser_plugin(const Ref<EditorTranslationParserPlugin> &p_parser);
|
||||
void remove_translation_parser_plugin(const Ref<EditorTranslationParserPlugin> &p_parser);
|
||||
|
||||
|
|
|
@ -4007,12 +4007,6 @@ void ScriptEditorPlugin::apply_changes() {
|
|||
script_editor->apply_scripts();
|
||||
}
|
||||
|
||||
void ScriptEditorPlugin::restore_global_state() {
|
||||
}
|
||||
|
||||
void ScriptEditorPlugin::save_global_state() {
|
||||
}
|
||||
|
||||
void ScriptEditorPlugin::set_window_layout(Ref<ConfigFile> p_layout) {
|
||||
script_editor->set_window_layout(p_layout);
|
||||
}
|
||||
|
|
|
@ -542,9 +542,6 @@ public:
|
|||
virtual void save_external_data() override;
|
||||
virtual void apply_changes() override;
|
||||
|
||||
virtual void restore_global_state() override;
|
||||
virtual void save_global_state() override;
|
||||
|
||||
virtual void set_window_layout(Ref<ConfigFile> p_layout) override;
|
||||
virtual void get_window_layout(Ref<ConfigFile> p_layout) override;
|
||||
|
||||
|
|
|
@ -1582,10 +1582,6 @@ void Control::set_block_minimum_size_adjust(bool p_block) {
|
|||
data.block_minimum_size_adjust = p_block;
|
||||
}
|
||||
|
||||
bool Control::is_minimum_size_adjust_blocked() const {
|
||||
return data.block_minimum_size_adjust;
|
||||
}
|
||||
|
||||
Size2 Control::get_minimum_size() const {
|
||||
Vector2 ms;
|
||||
GDVIRTUAL_CALL(_get_minimum_size, ms);
|
||||
|
|
|
@ -464,7 +464,6 @@ public:
|
|||
void update_minimum_size();
|
||||
|
||||
void set_block_minimum_size_adjust(bool p_block);
|
||||
bool is_minimum_size_adjust_blocked() const;
|
||||
|
||||
virtual Size2 get_minimum_size() const;
|
||||
virtual Size2 get_combined_minimum_size() const;
|
||||
|
|
|
@ -309,12 +309,6 @@ void ItemList::set_item_tag_icon(int p_idx, const Ref<Texture2D> &p_tag_icon) {
|
|||
shape_changed = true;
|
||||
}
|
||||
|
||||
Ref<Texture2D> ItemList::get_item_tag_icon(int p_idx) const {
|
||||
ERR_FAIL_INDEX_V(p_idx, items.size(), Ref<Texture2D>());
|
||||
|
||||
return items[p_idx].tag_icon;
|
||||
}
|
||||
|
||||
void ItemList::set_item_selectable(int p_idx, bool p_selectable) {
|
||||
if (p_idx < 0) {
|
||||
p_idx += get_item_count();
|
||||
|
|
|
@ -191,7 +191,6 @@ public:
|
|||
Variant get_item_metadata(int p_idx) const;
|
||||
|
||||
void set_item_tag_icon(int p_idx, const Ref<Texture2D> &p_tag_icon);
|
||||
Ref<Texture2D> get_item_tag_icon(int p_idx) const;
|
||||
|
||||
void set_item_tooltip_enabled(int p_idx, const bool p_enabled);
|
||||
bool is_item_tooltip_enabled(int p_idx) const;
|
||||
|
|
|
@ -49,10 +49,6 @@
|
|||
|
||||
///
|
||||
|
||||
void ResourceLoaderText::set_local_path(const String &p_local_path) {
|
||||
res_path = p_local_path;
|
||||
}
|
||||
|
||||
Ref<Resource> ResourceLoaderText::get_resource() {
|
||||
return resource;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,6 @@ class ResourceLoaderText {
|
|||
Ref<PackedScene> _parse_node_tag(VariantParser::ResourceParser &parser);
|
||||
|
||||
public:
|
||||
void set_local_path(const String &p_local_path);
|
||||
Ref<Resource> get_resource();
|
||||
Error load();
|
||||
Error set_uid(Ref<FileAccess> p_f, ResourceUID::ID p_uid);
|
||||
|
|
Loading…
Reference in New Issue