mirror of
https://github.com/godotengine/godot.git
synced 2025-02-17 08:10:42 +00:00
Merge pull request #62268 from V-Sekai/lightmap-errors
This commit is contained in:
commit
cac4e39ad2
@ -331,6 +331,7 @@ void ImporterMesh::generate_lods(float p_normal_merge_angle, float p_normal_spli
|
||||
|
||||
bool is_uvs_close = (!uvs_ptr || uvs_ptr[j].distance_squared_to(uvs_ptr[idx.second]) < CMP_EPSILON2);
|
||||
bool is_uv2s_close = (!uv2s_ptr || uv2s_ptr[j].distance_squared_to(uv2s_ptr[idx.second]) < CMP_EPSILON2);
|
||||
ERR_FAIL_INDEX(idx.second, normals.size());
|
||||
bool is_normals_close = normals[idx.second].dot(n) > normal_merge_threshold;
|
||||
if (is_uvs_close && is_uv2s_close && is_normals_close) {
|
||||
vertex_remap.push_back(idx.first);
|
||||
@ -1046,6 +1047,10 @@ Error ImporterMesh::lightmap_unwrap_cached(const Transform3D &p_base_transform,
|
||||
|
||||
PackedVector3Array rnormals = arrays[Mesh::ARRAY_NORMAL];
|
||||
|
||||
if (!rnormals.size()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int vertex_ofs = vertices.size() / 3;
|
||||
|
||||
vertices.resize((vertex_ofs + vc) * 3);
|
||||
@ -1086,6 +1091,9 @@ Error ImporterMesh::lightmap_unwrap_cached(const Transform3D &p_base_transform,
|
||||
|
||||
} else {
|
||||
for (int j = 0; j < ic / 3; j++) {
|
||||
ERR_FAIL_INDEX_V(rindices[j * 3 + 0], rvertices.size(), ERR_INVALID_DATA);
|
||||
ERR_FAIL_INDEX_V(rindices[j * 3 + 1], rvertices.size(), ERR_INVALID_DATA);
|
||||
ERR_FAIL_INDEX_V(rindices[j * 3 + 2], rvertices.size(), ERR_INVALID_DATA);
|
||||
Vector3 p0 = transform.xform(rvertices[rindices[j * 3 + 0]]);
|
||||
Vector3 p1 = transform.xform(rvertices[rindices[j * 3 + 1]]);
|
||||
Vector3 p2 = transform.xform(rvertices[rindices[j * 3 + 2]]);
|
||||
|
Loading…
Reference in New Issue
Block a user