1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

-Add lightmapper

-Fixes to unwrapper (remove degenerates), makes Thekla not crash
-Added optional cancel button in EditorProgress
-Added function to force processing of events (needed for cancel button)
This commit is contained in:
Juan Linietsky
2017-12-14 08:59:46 -03:00
parent aa6772d7ab
commit f3ad14224e
44 changed files with 4585 additions and 1139 deletions

View File

@@ -1123,27 +1123,29 @@ Error ArrayMesh::lightmap_unwrap(const Transform &p_base_transform, float p_texe
PoolVector<int> rindices = arrays[Mesh::ARRAY_INDEX];
int ic = rindices.size();
int index_ofs = indices.size();
if (ic == 0) {
indices.resize(index_ofs + vc);
face_materials.resize((index_ofs + vc) / 3);
for (int j = 0; j < vc; j++) {
indices[index_ofs + j] = vertex_ofs + j;
}
for (int j = 0; j < vc / 3; j++) {
face_materials[(index_ofs / 3) + j] = i;
if (Face3(r[j * 3 + 0], r[j * 3 + 1], r[j * 3 + 2]).is_degenerate())
continue;
indices.push_back(vertex_ofs + j * 3 + 0);
indices.push_back(vertex_ofs + j * 3 + 1);
indices.push_back(vertex_ofs + j * 3 + 2);
face_materials.push_back(i);
}
} else {
PoolVector<int>::Read ri = rindices.read();
indices.resize(index_ofs + ic);
face_materials.resize((index_ofs + ic) / 3);
for (int j = 0; j < ic; j++) {
indices[index_ofs + j] = vertex_ofs + ri[j];
}
for (int j = 0; j < ic / 3; j++) {
face_materials[(index_ofs / 3) + j] = i;
if (Face3(r[ri[j * 3 + 0]], r[ri[j * 3 + 1]], r[ri[j * 3 + 2]]).is_degenerate())
continue;
indices.push_back(vertex_ofs + ri[j * 3 + 0]);
indices.push_back(vertex_ofs + ri[j * 3 + 1]);
indices.push_back(vertex_ofs + ri[j * 3 + 2]);
face_materials.push_back(i);
}
}