summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/mesh.cpp16
-rw-r--r--scene/resources/primitive_meshes.cpp2
-rw-r--r--scene/resources/resource_format_text.cpp12
3 files changed, 13 insertions, 17 deletions
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index a063b7f74f..5e032c41bf 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -252,10 +252,12 @@ Ref<Shape> Mesh::create_trimesh_shape() const {
Vector<Vector3> face_points;
face_points.resize(faces.size() * 3);
- for (int i = 0; i < face_points.size(); i++) {
+ for (int i = 0; i < face_points.size(); i += 3) {
Face3 f = faces.get(i / 3);
- face_points.set(i, f.vertex[i % 3]);
+ face_points.set(i, f.vertex[0]);
+ face_points.set(i + 1, f.vertex[1]);
+ face_points.set(i + 2, f.vertex[2]);
}
Ref<ConcavePolygonShape> shape = memnew(ConcavePolygonShape);
@@ -543,15 +545,9 @@ Vector<Ref<Shape> > Mesh::convex_decompose() const {
ERR_FAIL_COND_V(!convex_composition_function, Vector<Ref<Shape> >());
- Vector<Face3> faces = get_faces();
- Vector<Face3> f3;
- f3.resize(faces.size());
- const Face3 *f = faces.ptr();
- for (int i = 0; i < f3.size(); i++) {
- f3.write[i] = f[i];
- }
+ const Vector<Face3> faces = get_faces();
- Vector<Vector<Face3> > decomposed = convex_composition_function(f3);
+ Vector<Vector<Face3> > decomposed = convex_composition_function(faces);
Vector<Ref<Shape> > ret;
diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp
index 00fc016ca1..959ee214a2 100644
--- a/scene/resources/primitive_meshes.cpp
+++ b/scene/resources/primitive_meshes.cpp
@@ -150,7 +150,7 @@ Array PrimitiveMesh::surface_get_blend_shape_arrays(int p_surface) const {
uint32_t PrimitiveMesh::surface_get_format(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx, 1, 0);
- return VS::ARRAY_COMPRESS_DEFAULT;
+ return VS::ARRAY_FORMAT_VERTEX | VS::ARRAY_FORMAT_NORMAL | VS::ARRAY_FORMAT_TANGENT | VS::ARRAY_FORMAT_TEX_UV | VS::ARRAY_FORMAT_INDEX | VS::ARRAY_COMPRESS_DEFAULT;
}
Mesh::PrimitiveType PrimitiveMesh::surface_get_primitive_type(int p_idx) const {
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index 97bd12c119..238bdf05ef 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -403,8 +403,6 @@ Ref<PackedScene> ResourceLoaderText::_parse_node_tag(VariantParser::ResourcePars
return Ref<PackedScene>();
}
}
-
- return packed_scene;
}
Error ResourceLoaderText::load() {
@@ -671,10 +669,6 @@ Error ResourceLoaderText::load() {
return error;
}
}
-
- if (progress) {
- *progress = resource_current / float(resources_total);
- }
}
//for scene files
@@ -731,9 +725,15 @@ void ResourceLoaderText::set_translation_remapped(bool p_remapped) {
}
ResourceLoaderText::ResourceLoaderText() {
+ resources_total = 0;
+ resource_current = 0;
+ use_sub_threads = false;
+
progress = nullptr;
+ lines = false;
translation_remapped = false;
use_sub_threads = false;
+ error = OK;
}
ResourceLoaderText::~ResourceLoaderText() {