Browse Source

Merge pull request #58307 from timothyqiu/normals-size

Fix crash when importing small GLTF mesh
Rémi Verschelde 3 years ago
parent
commit
9c11d80ea6
1 changed files with 1 additions and 1 deletions
  1. 1 1
      scene/resources/importer_mesh.cpp

+ 1 - 1
scene/resources/importer_mesh.cpp

@@ -287,7 +287,7 @@ void ImporterMesh::generate_lods(float p_normal_merge_angle, float p_normal_spli
 		const int *indices_ptr = indices.ptr();
 		const int *indices_ptr = indices.ptr();
 
 
 		if (normals.is_empty()) {
 		if (normals.is_empty()) {
-			normals.resize(vertices.size());
+			normals.resize(index_count);
 			Vector3 *n_ptr = normals.ptrw();
 			Vector3 *n_ptr = normals.ptrw();
 			for (unsigned int j = 0; j < index_count; j += 3) {
 			for (unsigned int j = 0; j < index_count; j += 3) {
 				const Vector3 &v0 = vertices_ptr[indices_ptr[j + 0]];
 				const Vector3 &v0 = vertices_ptr[indices_ptr[j + 0]];